<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.17"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>QuEST: Unitaries</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="style.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand"><img alt="Logo" src="logo.png"/></a>
                    <a class="navbar-brand"><b>QuEST</b> v3.2.0<br>The Quantum Exact Simulation Toolkit</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Unitaries</div>  </div>
</div><!--header-->
<div class="contents">

<p>Unitary gates.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaefaa7acba90373efe4e0f0b94987c734"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gaefaa7acba90373efe4e0f0b94987c734">compactUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, <a class="el" href="structComplex.html">Complex</a> alpha, <a class="el" href="structComplex.html">Complex</a> beta)</td></tr>
<tr class="memdesc:gaefaa7acba90373efe4e0f0b94987c734"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a single-qubit unitary parameterised by two given complex scalars.  <a href="group__unitary.html#gaefaa7acba90373efe4e0f0b94987c734">More...</a><br /></td></tr>
<tr class="separator:gaefaa7acba90373efe4e0f0b94987c734"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf7e15bf09c64082e0a8467998eb25623"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gaf7e15bf09c64082e0a8467998eb25623">controlledCompactUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="structComplex.html">Complex</a> alpha, <a class="el" href="structComplex.html">Complex</a> beta)</td></tr>
<tr class="memdesc:gaf7e15bf09c64082e0a8467998eb25623"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a controlled unitary (single control, single target) parameterised by two given complex scalars.  <a href="group__unitary.html#gaf7e15bf09c64082e0a8467998eb25623">More...</a><br /></td></tr>
<tr class="separator:gaf7e15bf09c64082e0a8467998eb25623"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaeb975903209000ebbaf50ef1cc353a79"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gaeb975903209000ebbaf50ef1cc353a79">controlledMultiQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int ctrl, int *targs, int numTargs, <a class="el" href="structComplexMatrixN.html">ComplexMatrixN</a> u)</td></tr>
<tr class="memdesc:gaeb975903209000ebbaf50ef1cc353a79"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general controlled multi-qubit unitary (including a global phase factor).  <a href="group__unitary.html#gaeb975903209000ebbaf50ef1cc353a79">More...</a><br /></td></tr>
<tr class="separator:gaeb975903209000ebbaf50ef1cc353a79"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa5a138473a4433c853c6e66e7aabc237"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gaa5a138473a4433c853c6e66e7aabc237">controlledNot</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit)</td></tr>
<tr class="memdesc:gaa5a138473a4433c853c6e66e7aabc237"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the controlled not (single control, single target) gate, also known as the c-X, c-sigma-X, c-Pauli-X and c-bit-flip gate.  <a href="group__unitary.html#gaa5a138473a4433c853c6e66e7aabc237">More...</a><br /></td></tr>
<tr class="separator:gaa5a138473a4433c853c6e66e7aabc237"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5e5fdaa7d3dd449b3e2c5d4a01bd015a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga5e5fdaa7d3dd449b3e2c5d4a01bd015a">controlledPauliY</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit)</td></tr>
<tr class="memdesc:ga5e5fdaa7d3dd449b3e2c5d4a01bd015a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the controlled pauliY (single control, single target) gate, also known as the c-Y and c-sigma-Y gate.  <a href="group__unitary.html#ga5e5fdaa7d3dd449b3e2c5d4a01bd015a">More...</a><br /></td></tr>
<tr class="separator:ga5e5fdaa7d3dd449b3e2c5d4a01bd015a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2fa310101ecffd6aeba96f77b7d85f56"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga2fa310101ecffd6aeba96f77b7d85f56">controlledPhaseFlip</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int idQubit1, int idQubit2)</td></tr>
<tr class="memdesc:ga2fa310101ecffd6aeba96f77b7d85f56"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the (two-qubit) controlled phase flip gate, also known as the controlled pauliZ gate.  <a href="group__unitary.html#ga2fa310101ecffd6aeba96f77b7d85f56">More...</a><br /></td></tr>
<tr class="separator:ga2fa310101ecffd6aeba96f77b7d85f56"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7214a79aa22ae7a50ad6f38615968cb0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga7214a79aa22ae7a50ad6f38615968cb0">controlledPhaseShift</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int idQubit1, int idQubit2, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga7214a79aa22ae7a50ad6f38615968cb0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Introduce a phase factor <img class="formulaInl" alt="$ \exp(i \theta) $" src="form_19.png"/> on state <img class="formulaInl" alt="$ |11\rangle $" src="form_20.png"/> of qubits <code>idQubit1</code> and <code>idQubit2</code>.  <a href="group__unitary.html#ga7214a79aa22ae7a50ad6f38615968cb0">More...</a><br /></td></tr>
<tr class="separator:ga7214a79aa22ae7a50ad6f38615968cb0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0c84c429cb1d7e2596706c1804dd9cba"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga0c84c429cb1d7e2596706c1804dd9cba">controlledRotateAroundAxis</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle, <a class="el" href="structVector.html">Vector</a> axis)</td></tr>
<tr class="memdesc:ga0c84c429cb1d7e2596706c1804dd9cba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Applies a controlled rotation by a given angle around a given vector on the Bloch-sphere.  <a href="group__unitary.html#ga0c84c429cb1d7e2596706c1804dd9cba">More...</a><br /></td></tr>
<tr class="separator:ga0c84c429cb1d7e2596706c1804dd9cba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga13f904b417f647c70d163770e65906fc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga13f904b417f647c70d163770e65906fc">controlledRotateX</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga13f904b417f647c70d163770e65906fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Applies a controlled rotation by a given angle around the X-axis of the Bloch-sphere.  <a href="group__unitary.html#ga13f904b417f647c70d163770e65906fc">More...</a><br /></td></tr>
<tr class="separator:ga13f904b417f647c70d163770e65906fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafbbded98b7233f5da06d74d1db5cbfdb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gafbbded98b7233f5da06d74d1db5cbfdb">controlledRotateY</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:gafbbded98b7233f5da06d74d1db5cbfdb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Applies a controlled rotation by a given angle around the Y-axis of the Bloch-sphere.  <a href="group__unitary.html#gafbbded98b7233f5da06d74d1db5cbfdb">More...</a><br /></td></tr>
<tr class="separator:gafbbded98b7233f5da06d74d1db5cbfdb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7eb969c1dd6c949aecf716d2fba71120"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga7eb969c1dd6c949aecf716d2fba71120">controlledRotateZ</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga7eb969c1dd6c949aecf716d2fba71120"><td class="mdescLeft">&#160;</td><td class="mdescRight">Applies a controlled rotation by a given angle around the Z-axis of the Bloch-sphere.  <a href="group__unitary.html#ga7eb969c1dd6c949aecf716d2fba71120">More...</a><br /></td></tr>
<tr class="separator:ga7eb969c1dd6c949aecf716d2fba71120"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3d89916b46bc4aaf23e938022e6c89c1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga3d89916b46bc4aaf23e938022e6c89c1">controlledTwoQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit1, int targetQubit2, <a class="el" href="structComplexMatrix4.html">ComplexMatrix4</a> u)</td></tr>
<tr class="memdesc:ga3d89916b46bc4aaf23e938022e6c89c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general controlled two-qubit unitary (including a global phase factor).  <a href="group__unitary.html#ga3d89916b46bc4aaf23e938022e6c89c1">More...</a><br /></td></tr>
<tr class="separator:ga3d89916b46bc4aaf23e938022e6c89c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa3fb996a5cadd098f4acd8aec955cf9c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gaa3fb996a5cadd098f4acd8aec955cf9c">controlledUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="memdesc:gaa3fb996a5cadd098f4acd8aec955cf9c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general controlled unitary (single control, single target), which can include a global phase factor.  <a href="group__unitary.html#gaa3fb996a5cadd098f4acd8aec955cf9c">More...</a><br /></td></tr>
<tr class="separator:gaa3fb996a5cadd098f4acd8aec955cf9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6532decd6c404189915563492f090e6f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga6532decd6c404189915563492f090e6f">hadamard</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="memdesc:ga6532decd6c404189915563492f090e6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the single-qubit Hadamard gate.  <a href="group__unitary.html#ga6532decd6c404189915563492f090e6f">More...</a><br /></td></tr>
<tr class="separator:ga6532decd6c404189915563492f090e6f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3ad6c477edcdbc845fc1143e860fda08"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga3ad6c477edcdbc845fc1143e860fda08">multiControlledMultiQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *ctrls, int numCtrls, int *targs, int numTargs, <a class="el" href="structComplexMatrixN.html">ComplexMatrixN</a> u)</td></tr>
<tr class="memdesc:ga3ad6c477edcdbc845fc1143e860fda08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general multi-controlled multi-qubit unitary (including a global phase factor).  <a href="group__unitary.html#ga3ad6c477edcdbc845fc1143e860fda08">More...</a><br /></td></tr>
<tr class="separator:ga3ad6c477edcdbc845fc1143e860fda08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad76781842af56821ed4e223bd776f057"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gad76781842af56821ed4e223bd776f057">multiControlledPhaseFlip</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *controlQubits, int numControlQubits)</td></tr>
<tr class="memdesc:gad76781842af56821ed4e223bd776f057"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the multiple-qubit controlled phase flip gate, also known as the multiple-qubit controlled pauliZ gate.  <a href="group__unitary.html#gad76781842af56821ed4e223bd776f057">More...</a><br /></td></tr>
<tr class="separator:gad76781842af56821ed4e223bd776f057"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0832e39058d913ad47af44e97a854446"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga0832e39058d913ad47af44e97a854446">multiControlledPhaseShift</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *controlQubits, int numControlQubits, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga0832e39058d913ad47af44e97a854446"><td class="mdescLeft">&#160;</td><td class="mdescRight">Introduce a phase factor <img class="formulaInl" alt="$ \exp(i \theta) $" src="form_19.png"/> on state <img class="formulaInl" alt="$ |1 \dots 1 \rangle $" src="form_23.png"/> of the passed qubits.  <a href="group__unitary.html#ga0832e39058d913ad47af44e97a854446">More...</a><br /></td></tr>
<tr class="separator:ga0832e39058d913ad47af44e97a854446"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga65c7879947e398690a5428bd43e143e3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga65c7879947e398690a5428bd43e143e3">multiControlledTwoQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *controlQubits, int numControlQubits, int targetQubit1, int targetQubit2, <a class="el" href="structComplexMatrix4.html">ComplexMatrix4</a> u)</td></tr>
<tr class="memdesc:ga65c7879947e398690a5428bd43e143e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general multi-controlled two-qubit unitary (including a global phase factor).  <a href="group__unitary.html#ga65c7879947e398690a5428bd43e143e3">More...</a><br /></td></tr>
<tr class="separator:ga65c7879947e398690a5428bd43e143e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa700dc9657ade4cf16f1cad1624c5332"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gaa700dc9657ade4cf16f1cad1624c5332">multiControlledUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *controlQubits, int numControlQubits, int targetQubit, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="memdesc:gaa700dc9657ade4cf16f1cad1624c5332"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general multiple-control single-target unitary, which can include a global phase factor.  <a href="group__unitary.html#gaa700dc9657ade4cf16f1cad1624c5332">More...</a><br /></td></tr>
<tr class="separator:gaa700dc9657ade4cf16f1cad1624c5332"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga20bf9b8a71b8a3ee4651e9497e6d1f4f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga20bf9b8a71b8a3ee4651e9497e6d1f4f">multiQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *targs, int numTargs, <a class="el" href="structComplexMatrixN.html">ComplexMatrixN</a> u)</td></tr>
<tr class="memdesc:ga20bf9b8a71b8a3ee4651e9497e6d1f4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general multi-qubit unitary (including a global phase factor) with any number of target qubits.  <a href="group__unitary.html#ga20bf9b8a71b8a3ee4651e9497e6d1f4f">More...</a><br /></td></tr>
<tr class="separator:ga20bf9b8a71b8a3ee4651e9497e6d1f4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga34aa4865c92f9aa5d898c91286c9eca5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga34aa4865c92f9aa5d898c91286c9eca5">multiRotatePauli</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *targetQubits, enum <a class="el" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a> *targetPaulis, int numTargets, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga34aa4865c92f9aa5d898c91286c9eca5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a multi-qubit multi-Pauli rotation on a selected number of qubits.  <a href="group__unitary.html#ga34aa4865c92f9aa5d898c91286c9eca5">More...</a><br /></td></tr>
<tr class="separator:ga34aa4865c92f9aa5d898c91286c9eca5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3250d0d95b5d755cad542a6a2372b894"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga3250d0d95b5d755cad542a6a2372b894">multiRotateZ</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *qubits, int numQubits, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga3250d0d95b5d755cad542a6a2372b894"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a multi-qubit Z rotation on a selected number of qubits.  <a href="group__unitary.html#ga3250d0d95b5d755cad542a6a2372b894">More...</a><br /></td></tr>
<tr class="separator:ga3250d0d95b5d755cad542a6a2372b894"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga41b946a82982c3fa3dc2a7395665bc90"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga41b946a82982c3fa3dc2a7395665bc90">multiStateControlledUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int *controlQubits, int *controlState, int numControlQubits, int targetQubit, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="memdesc:ga41b946a82982c3fa3dc2a7395665bc90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general multiple-control, conditioned on a specific bit sequence, single-target unitary, which can include a global phase factor.  <a href="group__unitary.html#ga41b946a82982c3fa3dc2a7395665bc90">More...</a><br /></td></tr>
<tr class="separator:ga41b946a82982c3fa3dc2a7395665bc90"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4193c14cfb918fa3291fb0648058d63e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga4193c14cfb918fa3291fb0648058d63e">pauliX</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="memdesc:ga4193c14cfb918fa3291fb0648058d63e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the single-qubit Pauli-X (also known as the X, sigma-X, NOT or bit-flip) gate.  <a href="group__unitary.html#ga4193c14cfb918fa3291fb0648058d63e">More...</a><br /></td></tr>
<tr class="separator:ga4193c14cfb918fa3291fb0648058d63e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8e0f03e745778a89d6f59c3c25e32df8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga8e0f03e745778a89d6f59c3c25e32df8">pauliY</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="memdesc:ga8e0f03e745778a89d6f59c3c25e32df8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the single-qubit Pauli-Y (also known as the Y or sigma-Y) gate.  <a href="group__unitary.html#ga8e0f03e745778a89d6f59c3c25e32df8">More...</a><br /></td></tr>
<tr class="separator:ga8e0f03e745778a89d6f59c3c25e32df8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5d80b490e3910aa737a81bb597cdfcc9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga5d80b490e3910aa737a81bb597cdfcc9">pauliZ</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="memdesc:ga5d80b490e3910aa737a81bb597cdfcc9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the single-qubit Pauli-Z (also known as the Z, sigma-Z or phase-flip) gate.  <a href="group__unitary.html#ga5d80b490e3910aa737a81bb597cdfcc9">More...</a><br /></td></tr>
<tr class="separator:ga5d80b490e3910aa737a81bb597cdfcc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga26baa057f5db8804825c2d611386753b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga26baa057f5db8804825c2d611386753b">phaseShift</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga26baa057f5db8804825c2d611386753b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shift the phase between <img class="formulaInl" alt="$ |0\rangle $" src="form_14.png"/> and <img class="formulaInl" alt="$ |1\rangle $" src="form_15.png"/> of a single qubit by a given angle.  <a href="group__unitary.html#ga26baa057f5db8804825c2d611386753b">More...</a><br /></td></tr>
<tr class="separator:ga26baa057f5db8804825c2d611386753b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4c708f066b244801e10f538b48b90145"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga4c708f066b244801e10f538b48b90145">rotateAroundAxis</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int rotQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle, <a class="el" href="structVector.html">Vector</a> axis)</td></tr>
<tr class="memdesc:ga4c708f066b244801e10f538b48b90145"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotate a single qubit by a given angle around a given <a class="el" href="structVector.html">Vector</a> on the Bloch-sphere.  <a href="group__unitary.html#ga4c708f066b244801e10f538b48b90145">More...</a><br /></td></tr>
<tr class="separator:ga4c708f066b244801e10f538b48b90145"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8886a3793b21622c48cf3bad6e15082d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga8886a3793b21622c48cf3bad6e15082d">rotateX</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int rotQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga8886a3793b21622c48cf3bad6e15082d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotate a single qubit by a given angle around the X-axis of the Bloch-sphere.  <a href="group__unitary.html#ga8886a3793b21622c48cf3bad6e15082d">More...</a><br /></td></tr>
<tr class="separator:ga8886a3793b21622c48cf3bad6e15082d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga34312ff52cc28bcab3cbd2ff338fd081"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga34312ff52cc28bcab3cbd2ff338fd081">rotateY</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int rotQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:ga34312ff52cc28bcab3cbd2ff338fd081"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotate a single qubit by a given angle around the Y-axis of the Bloch-sphere.  <a href="group__unitary.html#ga34312ff52cc28bcab3cbd2ff338fd081">More...</a><br /></td></tr>
<tr class="separator:ga34312ff52cc28bcab3cbd2ff338fd081"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab23a8b022ec83b9d423961ca87cd8cb5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gab23a8b022ec83b9d423961ca87cd8cb5">rotateZ</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int rotQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle)</td></tr>
<tr class="memdesc:gab23a8b022ec83b9d423961ca87cd8cb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rotate a single qubit by a given angle around the Z-axis of the Bloch-sphere (also known as a phase shift gate).  <a href="group__unitary.html#gab23a8b022ec83b9d423961ca87cd8cb5">More...</a><br /></td></tr>
<tr class="separator:gab23a8b022ec83b9d423961ca87cd8cb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga655ffcd4def2e127341c9488f5ca8455"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga655ffcd4def2e127341c9488f5ca8455">sGate</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="memdesc:ga655ffcd4def2e127341c9488f5ca8455"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the single-qubit S gate.  <a href="group__unitary.html#ga655ffcd4def2e127341c9488f5ca8455">More...</a><br /></td></tr>
<tr class="separator:ga655ffcd4def2e127341c9488f5ca8455"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga75d5e65f87c68403602a669b9c6d52b0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga75d5e65f87c68403602a669b9c6d52b0">sqrtSwapGate</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int qb1, int qb2)</td></tr>
<tr class="memdesc:ga75d5e65f87c68403602a669b9c6d52b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a sqrt SWAP gate between <code>qubit1</code> and <code>qubit2</code>.  <a href="group__unitary.html#ga75d5e65f87c68403602a669b9c6d52b0">More...</a><br /></td></tr>
<tr class="separator:ga75d5e65f87c68403602a669b9c6d52b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga820fd139c035136819e371308c206e36"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga820fd139c035136819e371308c206e36">swapGate</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int qubit1, int qubit2)</td></tr>
<tr class="memdesc:ga820fd139c035136819e371308c206e36"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a SWAP gate between <code>qubit1</code> and <code>qubit2</code>.  <a href="group__unitary.html#ga820fd139c035136819e371308c206e36">More...</a><br /></td></tr>
<tr class="separator:ga820fd139c035136819e371308c206e36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac15907193da5a7c48b9610a26e669064"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gac15907193da5a7c48b9610a26e669064">tGate</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="memdesc:gac15907193da5a7c48b9610a26e669064"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply the single-qubit T gate.  <a href="group__unitary.html#gac15907193da5a7c48b9610a26e669064">More...</a><br /></td></tr>
<tr class="separator:gac15907193da5a7c48b9610a26e669064"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab525a42d63233f61afeb6be97d89dd36"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#gab525a42d63233f61afeb6be97d89dd36">twoQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit1, int targetQubit2, <a class="el" href="structComplexMatrix4.html">ComplexMatrix4</a> u)</td></tr>
<tr class="memdesc:gab525a42d63233f61afeb6be97d89dd36"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general two-qubit unitary (including a global phase factor).  <a href="group__unitary.html#gab525a42d63233f61afeb6be97d89dd36">More...</a><br /></td></tr>
<tr class="separator:gab525a42d63233f61afeb6be97d89dd36"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga78b814256f851cac70fdf3cbf9cfc206"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__unitary.html#ga78b814256f851cac70fdf3cbf9cfc206">unitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="memdesc:ga78b814256f851cac70fdf3cbf9cfc206"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply a general single-qubit unitary (including a global phase factor).  <a href="group__unitary.html#ga78b814256f851cac70fdf3cbf9cfc206">More...</a><br /></td></tr>
<tr class="separator:ga78b814256f851cac70fdf3cbf9cfc206"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Unitary gates. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaefaa7acba90373efe4e0f0b94987c734"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaefaa7acba90373efe4e0f0b94987c734">&#9670;&nbsp;</a></span>compactUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void compactUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplex.html">Complex</a>&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplex.html">Complex</a>&#160;</td>
          <td class="paramname"><em>beta</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a single-qubit unitary parameterised by two given complex scalars. </p>
<p>Given valid complex numbers <img class="formulaInl" alt="$\alpha$" src="form_41.png"/> and <img class="formulaInl" alt="$\beta$" src="form_42.png"/>, applies the unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ U = \begin{pmatrix} \alpha &amp; -\beta^* \\ \beta &amp; \alpha^* \end{pmatrix} \]" src="form_43.png"/>
</p>
<p> which is general up to a global phase factor. <br  />
 Valid <img class="formulaInl" alt="$\alpha$" src="form_41.png"/>, <img class="formulaInl" alt="$\beta$" src="form_42.png"/> satisfy <img class="formulaInl" alt="$|\alpha|^2 + |\beta|^2 = 1$" src="form_44.png"/>.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {U}; \end{tikzpicture} } \]" src="form_45.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">alpha</td><td>complex unitary parameter (row 1, column 1) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">beta</td><td>complex unitary parameter (row 2, column 1) </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>), or if <code>alpha</code>, <code>beta</code> don't satisfy |<code>alpha|^2</code> + |<code>beta|^2</code> = 1. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00405">405</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;                                                                               {</div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5d49d4aadea858794b139c6a195ffd8b">validateUnitaryComplexPair</a>(alpha, beta, __func__);</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;    </div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a>(qureg, targetQubit, alpha, beta);</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a>(qureg, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(alpha), <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(beta));</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    }</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160; </div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a518c4351d574aea8477019dbce02f09c">qasm_recordCompactUnitary</a>(qureg, alpha, beta, targetQubit);</div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00085">getConjugateScalar()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00195">qasm_recordCompactUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00844">statevec_compactUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00471">validateUnitaryComplexPair()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00046">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gaf7e15bf09c64082e0a8467998eb25623"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf7e15bf09c64082e0a8467998eb25623">&#9670;&nbsp;</a></span>controlledCompactUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledCompactUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplex.html">Complex</a>&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplex.html">Complex</a>&#160;</td>
          <td class="paramname"><em>beta</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a controlled unitary (single control, single target) parameterised by two given complex scalars. </p>
<p>Given valid complex numbers <img class="formulaInl" alt="$\alpha$" src="form_41.png"/> and <img class="formulaInl" alt="$\beta$" src="form_42.png"/>, applies the two-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\ &amp; &amp; \alpha &amp; -\beta^* \\ &amp; &amp; \beta &amp; \alpha^* \end{pmatrix} \]" src="form_61.png"/>
</p>
<p> to the control and target qubits. Valid <img class="formulaInl" alt="$\alpha$" src="form_41.png"/>, <img class="formulaInl" alt="$\beta$" src="form_42.png"/> satisfy <img class="formulaInl" alt="$|\alpha|^2 + |\beta|^2 = 1$" src="form_44.png"/>. The target unitary is general up to a global phase factor. <br  />
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$U_{\alpha, \beta}$}; \end{tikzpicture} } \]" src="form_62.png"/>
</p>
<p><br  />
 </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>apply the target unitary if this qubit has value 1 </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit on which to apply the target unitary </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">alpha</td><td>complex unitary parameter (row 1, column 1) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">beta</td><td>complex unitary parameter (row 2, column 1) </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>) or are equal, or if <code>alpha</code>, <code>beta</code> don't satisfy |<code>alpha|^2</code> + |<code>beta|^2</code> = 1. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00418">418</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;                                                                                                           {</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5d49d4aadea858794b139c6a195ffd8b">validateUnitaryComplexPair</a>(alpha, beta, __func__);</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;    </div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a>(qureg, controlQubit, targetQubit, alpha, beta);</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a>(qureg, </div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;            controlQubit+shift, targetQubit+shift, </div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;            <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(alpha), <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(beta));</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;    }</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;    </div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a6bd68fa9c0c1bd9c9f9af714ea0b8b03">qasm_recordControlledCompactUnitary</a>(qureg, alpha, beta, controlQubit, targetQubit);</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00085">getConjugateScalar()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00264">qasm_recordControlledCompactUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00920">statevec_controlledCompactUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00471">validateUnitaryComplexPair()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00097">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gaeb975903209000ebbaf50ef1cc353a79"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaeb975903209000ebbaf50ef1cc353a79">&#9670;&nbsp;</a></span>controlledMultiQubitUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledMultiQubitUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>ctrl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>targs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numTargs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrixN.html">ComplexMatrixN</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general controlled multi-qubit unitary (including a global phase factor). </p>
<p>One control and any number of target qubits can be specified. This effects the many-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; 1 \\ &amp; &amp; &amp; 1 \\ &amp; &amp; &amp; &amp; u_{00} &amp; u_{01} &amp; \dots \\ &amp; &amp; &amp; &amp; u_{10} &amp; u_{11} &amp; \dots \\ &amp; &amp; &amp; &amp; \vdots &amp; \vdots &amp; \ddots \end{pmatrix} \]" src="form_152.png"/>
</p>
<p> on the control and target qubits.</p>
<p>The target qubits in <code>targs</code> are treated as ordered least significant to most significant in <code>u</code>.</p>
<p>The passed ComplexMatrix must be unitary and be a compatible size with the specified number of target qubits, otherwise an error is thrown.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 1) {targets}; \node[draw=none] at (-3.5, 4) {control}; \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw(0, 4) -- (0, 3); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-2,2) -- (-1, 2); \draw (1, 2) -- (2, 2); \draw (-1,-1)--(-1,3)--(1,3)--(1,-1); \node[draw=none] at (0, 1) {U}; \node[draw=none] at (0, -1) {$\vdots$}; \end{tikzpicture} } \]" src="form_153.png"/>
</p>
<p>Note that in multithreaded mode, each thread will clone 2^<code>numTargs</code> amplitudes, and store these in the runtime stack. Using t threads, the total memory overhead of this function is t*2^<code>numTargs</code>. For many targets (e.g. 16 qubits), this may cause a stack-overflow / seg-fault (e.g. on a 1 MiB stack).</p>
<p>Note too that in distributed mode, this routine requires that each node contains at least 2^<code>numTargs</code> amplitudes. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q / 2^<code>numTargs</code> nodes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ctrl</td><td>the control qubit </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targs</td><td>a list of the target qubits, ordered least to most significant </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numTargs</td><td>the number of target qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>ctrl</code> or any index in <code>targs</code> is outside of [0, <code>qureg.numQubitsRepresented</code>), or if <code>targs</code> are not unique, or if <code>targs</code> contains <code>ctrl</code>, or if matrix <code>u</code> is not unitary, or if a node cannot fit the required number of target amplitudes in distributed mode. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00314">314</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;                                                                                                    {</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, (<span class="keywordtype">int</span>[]) {ctrl}, 1, targs, numTargs, __func__);</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;    </div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;    <a class="code" href="QuEST__common_8c.html#a06b8474aec51579ff680fb66439e7fc6">statevec_controlledMultiQubitUnitary</a>(qureg, ctrl, targs, numTargs, u);</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, shift);</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;        <a class="code" href="QuEST__common_8c.html#a06b8474aec51579ff680fb66439e7fc6">statevec_controlledMultiQubitUnitary</a>(qureg, ctrl+shift, targs, numTargs, u);</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, -shift);</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;    }</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed controlled multi-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__common_8c_source.html#l00109">setConjugateMatrixN()</a>, <a class="el" href="QuEST__common_8c_source.html#l00150">shiftIndices()</a>, <a class="el" href="QuEST__common_8c_source.html#l00535">statevec_controlledMultiQubitUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00423">validateMultiControlsMultiTargets()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00466">validateMultiQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00155">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gaa5a138473a4433c853c6e66e7aabc237"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa5a138473a4433c853c6e66e7aabc237">&#9670;&nbsp;</a></span>controlledNot()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledNot </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the controlled not (single control, single target) gate, also known as the c-X, c-sigma-X, c-Pauli-X and c-bit-flip gate. </p>
<p>This applies pauliX to the target qubit if the control qubit has value 1. This effects the two-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; &amp; 1 \\ &amp; &amp; 1 \end{pmatrix} \]" src="form_80.png"/>
</p>
<p> on the control and target qubits.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, -.5); \draw (-2,0) -- (2, 0); \draw (0, 0) circle (.5); \end{tikzpicture} } \]" src="form_81.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>nots the target if this qubit is 1 </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to not </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or are equal. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00525">525</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;                                                                   {</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;    </div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;    <a class="code" href="QuEST__internal_8h.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a>(qureg, controlQubit, targetQubit);</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;        <a class="code" href="QuEST__internal_8h.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a>(qureg, controlQubit+shift, targetQubit+shift);</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;    }</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;    </div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55">GATE_SIGMA_X</a>, controlQubit, targetQubit);</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00021">GATE_SIGMA_X</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00238">qasm_recordControlledGate()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01061">statevec_controlledNot()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00295">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga5e5fdaa7d3dd449b3e2c5d4a01bd015a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5e5fdaa7d3dd449b3e2c5d4a01bd015a">&#9670;&nbsp;</a></span>controlledPauliY()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledPauliY </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the controlled pauliY (single control, single target) gate, also known as the c-Y and c-sigma-Y gate. </p>
<p>This applies pauliY to the target qubit if the control qubit has value 1. This effects the two-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; &amp; -i \\ &amp; &amp; i \end{pmatrix} \]" src="form_82.png"/>
</p>
<p> on the control and target qubits.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {Y}; \end{tikzpicture} } \]" src="form_83.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>applies pauliY to the target if this qubit is 1 </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to not </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or are equal. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd>
<dd>
Ania Brown (debug) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00537">537</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;                                                                      {</div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;    </div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a4e19ef93d01d7acea32ca646d623aedd">statevec_controlledPauliY</a>(qureg, controlQubit, targetQubit);</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a4a2fa262d3f0dba372797b9bd35d9fa5">statevec_controlledPauliYConj</a>(qureg, controlQubit+shift, targetQubit+shift);</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;    }</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;    </div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b">GATE_SIGMA_Y</a>, controlQubit, targetQubit);</div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00022">GATE_SIGMA_Y</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00238">qasm_recordControlledGate()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01140">statevec_controlledPauliY()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01173">statevec_controlledPauliYConj()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00341">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga2fa310101ecffd6aeba96f77b7d85f56"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2fa310101ecffd6aeba96f77b7d85f56">&#9670;&nbsp;</a></span>controlledPhaseFlip()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledPhaseFlip </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>idQubit1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>idQubit2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the (two-qubit) controlled phase flip gate, also known as the controlled pauliZ gate. </p>
<p>For each state, if both input qubits have value one, multiply the amplitude of that state by -1. This applies the two-qubit unitary: </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; 1 \\ &amp; &amp; &amp; -1 \end{pmatrix} \]" src="form_25.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {idQubit1}; \node[draw=none] at (-3.5, 0) {idQubit2}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 0); \draw (-2,0) -- (2, 0); \draw[fill=black] (0, 0) circle (.2); \end{tikzpicture} } \]" src="form_26.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">idQubit1,idQubit2</td><td>qubits to operate upon </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>idQubit1</code> or <code>idQubit2</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or are equal </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00549">549</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;                                                                  {</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, idQubit1, idQubit2, __func__);</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;    </div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aaf78491e35d165edfd57387f9fffecbd">statevec_controlledPhaseFlip</a>(qureg, idQubit1, idQubit2);</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aaf78491e35d165edfd57387f9fffecbd">statevec_controlledPhaseFlip</a>(qureg, idQubit1+shift, idQubit2+shift);</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;    }</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;    </div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a>, idQubit1, idQubit2);</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00023">GATE_SIGMA_Z</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00238">qasm_recordControlledGate()</a>, <a class="el" href="QuEST__cpu_8c_source.html#l03300">statevec_controlledPhaseFlip()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00387">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga7214a79aa22ae7a50ad6f38615968cb0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7214a79aa22ae7a50ad6f38615968cb0">&#9670;&nbsp;</a></span>controlledPhaseShift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledPhaseShift </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>idQubit1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>idQubit2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Introduce a phase factor <img class="formulaInl" alt="$ \exp(i \theta) $" src="form_19.png"/> on state <img class="formulaInl" alt="$ |11\rangle $" src="form_20.png"/> of qubits <code>idQubit1</code> and <code>idQubit2</code>. </p>
<p>For angle <img class="formulaInl" alt="$\theta$" src="form_16.png"/>, this effects the unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 &amp; &amp; &amp; \\ &amp; 1 &amp; &amp; \\ &amp; &amp; 1 &amp; \\ &amp; &amp; &amp; \exp(i \theta) \end{pmatrix} \]" src="form_21.png"/>
</p>
<p> on <code>idQubit1</code> and <code>idQubit2</code>.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {qubit1}; \node[draw=none] at (-3.5, 0) {qubit2}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_\theta$}; \end{tikzpicture} } \]" src="form_22.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">idQubit1</td><td>first qubit in the state to phase shift </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">idQubit2</td><td>second qubit in the state to phase shift </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>amount by which to shift the phase in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>idQubit1</code> or <code>idQubit2</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or are equal </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00499">499</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;                                                                                {</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, idQubit1, idQubit2, __func__);</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;    </div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a63df1ec14ff7cc81c3f392ac10fcc744">statevec_controlledPhaseShift</a>(qureg, idQubit1, idQubit2, angle);</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a63df1ec14ff7cc81c3f392ac10fcc744">statevec_controlledPhaseShift</a>(qureg, idQubit1+shift, idQubit2+shift, -angle);</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;    }</div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;    </div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a>, idQubit1, idQubit2, angle);</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00032">GATE_PHASE_SHIFT</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00247">qasm_recordControlledParamGate()</a>, <a class="el" href="QuEST__cpu_8c_source.html#l03019">statevec_controlledPhaseShift()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00433">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga0c84c429cb1d7e2596706c1804dd9cba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0c84c429cb1d7e2596706c1804dd9cba">&#9670;&nbsp;</a></span>controlledRotateAroundAxis()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledRotateAroundAxis </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structVector.html">Vector</a>&#160;</td>
          <td class="paramname"><em>axis</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Applies a controlled rotation by a given angle around a given vector on the Bloch-sphere. </p>
<p><br  />
 The vector must not be zero (else an error is thrown), but needn't be unit magnitude.</p>
<p>For angle <img class="formulaInl" alt="$\theta$" src="form_16.png"/> and axis vector <img class="formulaInl" alt="$\vec{n}$" src="form_54.png"/>, applies <img class="formulaInl" alt="$R_{\hat{n}} = \exp \left(- i \frac{\theta}{2} \hat{n} \cdot \vec{\sigma} \right) $" src="form_55.png"/> to states where the target qubit is 1 ( <img class="formulaInl" alt="$\vec{\sigma}$" src="form_56.png"/> is the vector of Pauli matrices).</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_{\hat{n}}(\theta)$}; \end{tikzpicture} } \]" src="form_60.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>qubit with value 1 in the rotated states </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate in radians </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">axis</td><td>vector around which to rotate (can be non-unit; will be normalised) </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>) or are equal or if <code>axis</code> is the zero vector </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00588">588</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;                                                                                                          {</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a782c6f57939eeb72b7be8e247979f3be">validateVector</a>(axis, __func__);</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;    </div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;    <a class="code" href="QuEST__common_8c.html#a336c3286d2434fc892ebe20e9fa22a24">statevec_controlledRotateAroundAxis</a>(qureg, controlQubit, targetQubit, angle, axis);</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;        <a class="code" href="QuEST__common_8c.html#a5ea2384a9b33c94eac891aacbfa5da6a">statevec_controlledRotateAroundAxisConj</a>(qureg, controlQubit+shift, targetQubit+shift, angle, axis);</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;    }</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;    </div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a33be8162c9633bb8015f06b38cf70735">qasm_recordControlledAxisRotation</a>(qureg, angle, axis, controlQubit, targetQubit);</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00300">qasm_recordControlledAxisRotation()</a>, <a class="el" href="QuEST__common_8c_source.html#l00327">statevec_controlledRotateAroundAxis()</a>, <a class="el" href="QuEST__common_8c_source.html#l00334">statevec_controlledRotateAroundAxisConj()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00475">validateVector()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00480">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga13f904b417f647c70d163770e65906fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga13f904b417f647c70d163770e65906fc">&#9670;&nbsp;</a></span>controlledRotateX()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledRotateX </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Applies a controlled rotation by a given angle around the X-axis of the Bloch-sphere. </p>
<p>The target qubit is rotated in states where the control qubit has value 1.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_x(\theta)$}; \end{tikzpicture} } \]" src="form_57.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>qubit which has value 1 in the rotated states </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate the target qubit in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>) or are equal. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00221">221</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;                                                                                    {</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;    </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    <a class="code" href="QuEST__common_8c.html#aa32eed5bc38e85193e1aa23b74e8541b">statevec_controlledRotateX</a>(qureg, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;        <a class="code" href="QuEST__common_8c.html#aa32eed5bc38e85193e1aa23b74e8541b">statevec_controlledRotateX</a>(qureg, controlQubit+shift, targetQubit+shift, -angle);</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    }</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    </div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361">GATE_ROTATE_X</a>, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00027">GATE_ROTATE_X</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00247">qasm_recordControlledParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00343">statevec_controlledRotateX()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00542">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gafbbded98b7233f5da06d74d1db5cbfdb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafbbded98b7233f5da06d74d1db5cbfdb">&#9670;&nbsp;</a></span>controlledRotateY()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledRotateY </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Applies a controlled rotation by a given angle around the Y-axis of the Bloch-sphere. </p>
<p>The target qubit is rotated in states where the control qubit has value 1.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_y(\theta)$}; \end{tikzpicture} } \]" src="form_58.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>qubit which has value 1 in the rotated states </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate the target qubit in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>) or are equal. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00233">233</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;                                                                                    {</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;    </div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;    <a class="code" href="QuEST__common_8c.html#ade67874c89179541f616b3685595d3ae">statevec_controlledRotateY</a>(qureg, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        <a class="code" href="QuEST__common_8c.html#ade67874c89179541f616b3685595d3ae">statevec_controlledRotateY</a>(qureg, controlQubit+shift, targetQubit+shift, angle); <span class="comment">// rotateY is real</span></div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    }</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689">GATE_ROTATE_Y</a>, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00028">GATE_ROTATE_Y</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00247">qasm_recordControlledParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00349">statevec_controlledRotateY()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00589">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga7eb969c1dd6c949aecf716d2fba71120"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7eb969c1dd6c949aecf716d2fba71120">&#9670;&nbsp;</a></span>controlledRotateZ()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledRotateZ </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Applies a controlled rotation by a given angle around the Z-axis of the Bloch-sphere. </p>
<p>The target qubit is rotated in states where the control qubit has value 1.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_z(\theta)$}; \end{tikzpicture} } \]" src="form_59.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>qubit which has value 1 in the rotated states </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate the target qubit in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>) or are equal. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00245">245</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;                                                                                    {</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;    </div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    <a class="code" href="QuEST__common_8c.html#a3e11a9b9fa5ee16d4738a97f4590ee61">statevec_controlledRotateZ</a>(qureg, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        <a class="code" href="QuEST__common_8c.html#a3e11a9b9fa5ee16d4738a97f4590ee61">statevec_controlledRotateZ</a>(qureg, controlQubit+shift, targetQubit+shift, -angle);</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    }</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    </div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877">GATE_ROTATE_Z</a>, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00029">GATE_ROTATE_Z</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00247">qasm_recordControlledParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00355">statevec_controlledRotateZ()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00636">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga3d89916b46bc4aaf23e938022e6c89c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3d89916b46bc4aaf23e938022e6c89c1">&#9670;&nbsp;</a></span>controlledTwoQubitUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledTwoQubitUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrix4.html">ComplexMatrix4</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general controlled two-qubit unitary (including a global phase factor). </p>
<p>The given unitary is applied to the target amplitudes where the control qubit has value 1. This effects the many-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\ &amp; &amp; 1 \\ &amp; &amp; &amp; 1 \\ &amp; &amp; &amp; &amp; u_{00} &amp; u_{01} &amp; u_{02} &amp; u_{03} \\ &amp; &amp; &amp; &amp; u_{10} &amp; u_{11} &amp; u_{12} &amp; u_{13} \\ &amp; &amp; &amp; &amp; u_{20} &amp; u_{21} &amp; u_{22} &amp; u_{23} \\ &amp; &amp; &amp; &amp; u_{30} &amp; u_{31} &amp; u_{32} &amp; u_{33} \end{pmatrix} \]" src="form_146.png"/>
</p>
<p> on the control and target qubits.</p>
<p><code>targetQubit1</code> is treated as the <code>least</code> significant qubit in <code>u</code>, such that a row in <code>u</code> is dotted with the vector <img class="formulaInl" alt="$ |\text{targetQubit2} \;\; \text{targetQubit1}\rangle : \{ |00\rangle, |01\rangle, |10\rangle, |11\rangle \} $" src="form_144.png"/></p>
<p>The passed 4x4 ComplexMatrix must be unitary, otherwise an error is thrown.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target1}; \node[draw=none] at (-3.5, 2) {target2}; \node[draw=none] at (-3.5, 4) {control}; \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw(0, 4) -- (0, 3); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-2,2) -- (-1, 2); \draw (1, 2) -- (2, 2); \draw (-1,-1)--(-1,3)--(1,3)--(1,-1)--cycle; \node[draw=none] at (0, 1) {U}; \end{tikzpicture} } \]" src="form_147.png"/>
</p>
<p>Note that in distributed mode, this routine requires that each node contains at least 4 amplitudes. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q/4 nodes.</p>
<p><br  />
 </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>the control qubit which must be in state 1 to effect the given unitary </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit1</td><td>first qubit to operate on, treated as least significant in <code>u</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit2</td><td>second qubit to operate on, treated as most significant in <code>u</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>controlQubit</code>, <code>targetQubit1</code> or <code>targetQubit2</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or if any of <code>controlQubit</code>, <code>targetQubit1</code> and <code>targetQubit2</code> are equal, or matrix <code>u</code> is not unitary, or if each node cannot fit 4 amplitudes in distributed mode. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00270">270</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;                                                                                                                    {</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, (<span class="keywordtype">int</span>[]) {controlQubit}, 1, (<span class="keywordtype">int</span>[]) {targetQubit1, targetQubit2}, 2, __func__);</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a>(qureg, u, __func__);</div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;    </div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    <a class="code" href="QuEST__common_8c.html#ad7ac4934371d72e24c6d1cea3d3da391">statevec_controlledTwoQubitUnitary</a>(qureg, controlQubit, targetQubit1, targetQubit2, u);</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;        <a class="code" href="QuEST__common_8c.html#ad7ac4934371d72e24c6d1cea3d3da391">statevec_controlledTwoQubitUnitary</a>(qureg, controlQubit+shift, targetQubit1+shift, targetQubit2+shift, <a class="code" href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a>(u));</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;    }</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160; </div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed controlled 2-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00104">getConjugateMatrix4()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__common_8c_source.html#l00523">statevec_controlledTwoQubitUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00423">validateMultiControlsMultiTargets()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00445">validateTwoQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00683">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gaa3fb996a5cadd098f4acd8aec955cf9c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa3fb996a5cadd098f4acd8aec955cf9c">&#9670;&nbsp;</a></span>controlledUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void controlledUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>controlQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general controlled unitary (single control, single target), which can include a global phase factor. </p>
<p>The given unitary is applied to the target qubit if the control qubit has value 1, effecting the two-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\ &amp; &amp; u_{00} &amp; u_{01}\\ &amp; &amp; u_{10} &amp; u_{11} \end{pmatrix} \]" src="form_63.png"/>
</p>
<p> on the control and target qubits.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target}; \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {U}; \end{tikzpicture} } \]" src="form_64.png"/>
</p>
<p><br  />
 </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubit</td><td>apply unitary if this qubit is 1 </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>single-qubit unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>controlQubit</code> or <code>targetQubit</code> are outside [0, <code>qureg.numQubitsRepresented</code>) or are equal, or if <code>u</code> is not unitary. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00361">361</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;                                                                                         {</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;    </div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;    <a class="code" href="QuEST__internal_8h.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a>(qureg, controlQubit, targetQubit, u);</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;        <a class="code" href="QuEST__internal_8h.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a>(qureg, controlQubit+shift, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;    }</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;    </div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a5e99d405002cdf6ddd40922911d058a4">qasm_recordControlledUnitary</a>(qureg, u, controlQubit, targetQubit);</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00099">getConjugateMatrix2()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00278">qasm_recordControlledUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00958">statevec_controlledUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00372">validateControlTarget()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00441">validateOneQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00760">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga6532decd6c404189915563492f090e6f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6532decd6c404189915563492f090e6f">&#9670;&nbsp;</a></span>hadamard()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void hadamard </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the single-qubit Hadamard gate. </p>
<p>This takes <img class="formulaInl" alt="$|0\rangle$" src="form_74.png"/> to <img class="formulaInl" alt="$|+\rangle$" src="form_75.png"/> and <img class="formulaInl" alt="$|1\rangle$" src="form_76.png"/> to <img class="formulaInl" alt="$|-\rangle$" src="form_77.png"/>, and is equivalent to a rotation of <img class="formulaInl" alt="$\pi$" src="form_67.png"/> around the x-axis then <img class="formulaInl" alt="$\pi/2$" src="form_29.png"/> about the y-axis on the Bloch-sphere. I.e. </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \frac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp; 1 \\ 1 &amp; -1 \end{pmatrix} \]" src="form_78.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {H}; \end{tikzpicture} } \]" src="form_79.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00177">177</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                                            {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    </div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <a class="code" href="QuEST__internal_8h.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;        <a class="code" href="QuEST__internal_8h.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    }</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    </div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa8417e56d80add49216437e0d451e8dd9">GATE_HADAMARD</a>, targetQubit);</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00026">GATE_HADAMARD</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00178">qasm_recordGate()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01206">statevec_hadamard()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00812">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga3ad6c477edcdbc845fc1143e860fda08"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3ad6c477edcdbc845fc1143e860fda08">&#9670;&nbsp;</a></span>multiControlledMultiQubitUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiControlledMultiQubitUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>ctrls</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numCtrls</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>targs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numTargs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrixN.html">ComplexMatrixN</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general multi-controlled multi-qubit unitary (including a global phase factor). </p>
<p>Any number of control and target qubits can be specified. This effects the many-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; \ddots \\ &amp; &amp; &amp; u_{00} &amp; u_{01} &amp; \dots \\ &amp; &amp; &amp; u_{10} &amp; u_{11} &amp; \dots \\ &amp; &amp; &amp; \vdots &amp; \vdots &amp; \ddots \end{pmatrix} \]" src="form_154.png"/>
</p>
<p> on the control and target qubits.</p>
<p>The target qubits in <code>targs</code> are treated as ordered least significant to most significant in <code>u</code>.</p>
<p>The passed ComplexMatrix must be unitary and be a compatible size with the specified number of target qubits, otherwise an error is thrown.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 1) {targets}; \node[draw=none] at (-3.5, 5) {controls}; \node[draw=none] at (0, 8) {$\vdots$}; \draw (0, 7) -- (0, 6); \draw (-2, 6) -- (2, 6); \draw[fill=black] (0, 6) circle (.2); \draw (0, 6) -- (0, 4); \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw(0, 4) -- (0, 3); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-2,2) -- (-1, 2); \draw (1, 2) -- (2, 2); \draw (-1,-1)--(-1,3)--(1,3)--(1,-1); \node[draw=none] at (0, 1) {U}; \node[draw=none] at (0, -1) {$\vdots$}; \end{tikzpicture} } \]" src="form_155.png"/>
</p>
<p>Note that in multithreaded mode, each thread will clone 2^<code>numTargs</code> amplitudes, and store these in the runtime stack. Using t threads, the total memory overhead of this function is t*2^<code>numTargs</code>. For many targets (e.g. 16 qubits), this may cause a stack-overflow / seg-fault (e.g. on a 1 MiB stack).</p>
<p>Note that in distributed mode, this routine requires that each node contains at least 2^<code>numTargs</code> amplitudes. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q / 2^<code>numTargs</code> nodes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ctrls</td><td>a list of the control qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numCtrls</td><td>the number of control qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targs</td><td>a list of the target qubits, ordered least to most significant </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numTargs</td><td>the number of target qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if any index in <code>ctrls</code> and <code>targs</code> is outside of [0, <code>qureg.numQubitsRepresented</code>), or if <code>ctrls</code> and <code>targs</code> are not unique, or if matrix <code>u</code> is not unitary, or if a node cannot fit the required number of target amplitudes in distributed mode. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00331">331</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;                                                                                                                         {</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, ctrls, numCtrls, targs, numTargs, __func__);</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    </div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(ctrls, numCtrls);</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a>(qureg, ctrlMask, targs, numTargs, u);</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, shift);</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a>(qureg, ctrlMask&lt;&lt;shift, targs, numTargs, u);</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, -shift);</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;    }</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    </div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed multi-controlled multi-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00044">getQubitBitMask()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__common_8c_source.html#l00109">setConjugateMatrixN()</a>, <a class="el" href="QuEST__common_8c_source.html#l00150">shiftIndices()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01437">statevec_multiControlledMultiQubitUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00423">validateMultiControlsMultiTargets()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00466">validateMultiQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l00852">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gad76781842af56821ed4e223bd776f057"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad76781842af56821ed4e223bd776f057">&#9670;&nbsp;</a></span>multiControlledPhaseFlip()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiControlledPhaseFlip </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>controlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numControlQubits</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the multiple-qubit controlled phase flip gate, also known as the multiple-qubit controlled pauliZ gate. </p>
<p>For each state, if all control qubits have value one, multiply the amplitude of that state by -1. This applies the many-qubit unitary: </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; \ddots \\ &amp; &amp; &amp; 1 \\ &amp; &amp; &amp; &amp; -1 \end{pmatrix} \]" src="form_27.png"/>
</p>
<p> on the control qubits.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {controls}; \node[draw=none] at (0, 6) {$\vdots$}; \draw (0, 5) -- (0, 4); \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw (0, 4) -- (0, 2); \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 0); \draw (-2,0) -- (2, 0); \draw[fill=black] (0, 0) circle (.2); \end{tikzpicture} } \]" src="form_28.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubits</td><td>array of input qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numControlQubits</td><td>number of input qubits </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>numControlQubits</code> is outside [1, <code>qureg.numQubitsRepresented</code>), or if any qubit in <code>controlQubits</code> is outside [0, <code>qureg.numQubitsRepresented</code>), or if any qubit in <code>qubits</code> is repeated. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00561">561</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;                                                                                     {</div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a9e7e85cfc36e3ce1f456a840a217bfd9">validateMultiQubits</a>(qureg, controlQubits, numControlQubits, __func__);</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;    </div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ac4ee5979d475e8c729294b8ef7e0270d">statevec_multiControlledPhaseFlip</a>(qureg, controlQubits, numControlQubits);</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, shift);</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;        <a class="code" href="QuEST__internal_8h.html#ac4ee5979d475e8c729294b8ef7e0270d">statevec_multiControlledPhaseFlip</a>(qureg, controlQubits, numControlQubits);</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, -shift);</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;    }</div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;    </div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#abecd71c919a35e5a87b07ba400edc7c2">qasm_recordMultiControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a>, controlQubits, numControlQubits-1, controlQubits[numControlQubits-1]);</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00023">GATE_SIGMA_Z</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00316">qasm_recordMultiControlledGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00150">shiftIndices()</a>, <a class="el" href="QuEST__cpu_8c_source.html#l03331">statevec_multiControlledPhaseFlip()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00408">validateMultiQubits()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01024">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga0832e39058d913ad47af44e97a854446"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0832e39058d913ad47af44e97a854446">&#9670;&nbsp;</a></span>multiControlledPhaseShift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiControlledPhaseShift </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>controlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numControlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Introduce a phase factor <img class="formulaInl" alt="$ \exp(i \theta) $" src="form_19.png"/> on state <img class="formulaInl" alt="$ |1 \dots 1 \rangle $" src="form_23.png"/> of the passed qubits. </p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {controls}; \node[draw=none] at (1, .7) {$\theta$}; \node[draw=none] at (0, 6) {$\vdots$}; \draw (0, 5) -- (0, 4); \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw (0, 4) -- (0, 2); \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 0); \draw (-2,0) -- (2, 0); \draw[fill=black] (0, 0) circle (.2); \end{tikzpicture} } \]" src="form_24.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubits</td><td>array of qubits to phase shift </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numControlQubits</td><td>the length of array <code>controlQubits</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>amount by which to shift the phase in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>numControlQubits</code> is outside [1, <code>qureg.numQubitsRepresented</code>]), or if any qubit index in <code>controlQubits</code> is outside [0, <code>qureg.numQubitsRepresented</code>]), or if any qubit in <code>controlQubits</code> is repeated. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00511">511</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;                                                                                                   {</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a9e7e85cfc36e3ce1f456a840a217bfd9">validateMultiQubits</a>(qureg, controlQubits, numControlQubits, __func__);</div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;    </div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa662796ea6e0f471143c53becae8c12c">statevec_multiControlledPhaseShift</a>(qureg, controlQubits, numControlQubits, angle);</div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, shift);</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aa662796ea6e0f471143c53becae8c12c">statevec_multiControlledPhaseShift</a>(qureg, controlQubits, numControlQubits, -angle);</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, -shift);</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;    }</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;    </div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a1445a08d034806627cc0b5aa0f4f6d3a">qasm_recordMultiControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a>, controlQubits, numControlQubits-1, controlQubits[numControlQubits-1], angle);</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00032">GATE_PHASE_SHIFT</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00324">qasm_recordMultiControlledParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00150">shiftIndices()</a>, <a class="el" href="QuEST__cpu_8c_source.html#l03059">statevec_multiControlledPhaseShift()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00408">validateMultiQubits()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01080">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga65c7879947e398690a5428bd43e143e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga65c7879947e398690a5428bd43e143e3">&#9670;&nbsp;</a></span>multiControlledTwoQubitUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiControlledTwoQubitUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>controlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numControlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrix4.html">ComplexMatrix4</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general multi-controlled two-qubit unitary (including a global phase factor). </p>
<p>Any number of control qubits can be specified, and if all have value 1, the given unitary is applied to the target qubit. This effects the many-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; \ddots \\ &amp; &amp; &amp; u_{00} &amp; u_{01} &amp; u_{02} &amp; u_{03} \\ &amp; &amp; &amp; u_{10} &amp; u_{11} &amp; u_{12} &amp; u_{13} \\ &amp; &amp; &amp; u_{20} &amp; u_{21} &amp; u_{22} &amp; u_{23} \\ &amp; &amp; &amp; u_{30} &amp; u_{31} &amp; u_{32} &amp; u_{33} \end{pmatrix} \]" src="form_148.png"/>
</p>
<p> on the control and target qubits.</p>
<p><code>targetQubit1</code> is treated as the <code>least</code> significant qubit in <code>u</code>, such that a row in <code>u</code> is dotted with the vector <img class="formulaInl" alt="$ |\text{targetQubit2} \;\; \text{targetQubit1}\rangle : \{ |00\rangle, |01\rangle, |10\rangle, |11\rangle \} $" src="form_144.png"/></p>
<p>The passed 4x4 ComplexMatrix must be unitary, otherwise an error is thrown.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target1}; \node[draw=none] at (-3.5, 2) {target2}; \node[draw=none] at (-3.5, 5) {controls}; \node[draw=none] at (0, 8) {$\vdots$}; \draw (0, 7) -- (0, 6); \draw (-2, 6) -- (2, 6); \draw[fill=black] (0, 6) circle (.2); \draw (0, 6) -- (0, 4); \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw(0, 4) -- (0, 3); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-2,2) -- (-1, 2); \draw (1, 2) -- (2, 2); \draw (-1,-1)--(-1,3)--(1,3)--(1,-1)--cycle; \node[draw=none] at (0, 1) {U}; \end{tikzpicture} } \]" src="form_149.png"/>
</p>
<p>Note that in distributed mode, this routine requires that each node contains at least 4 amplitudes. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q/4 nodes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubits</td><td>the control qubits which all must be in state 1 to effect the given unitary </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numControlQubits</td><td>the number of control qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit1</td><td>first target qubit, treated as least significant in <code>u</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit2</td><td>second target qubit, treated as most significant in <code>u</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit1</code> or <code>targetQubit2</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or if <code>targetQubit1</code> equals <code>targetQubit2</code>, or if any qubit in <code>controlQubits</code> is outside [0, <code>qureg.numQubitsRepresented</code>), or if <code>controlQubits</code> are not unique, or if either <code>targetQubit1</code> and <code>targetQubit2</code> are in <code>controlQubits</code>, or if matrix <code>u</code> is not unitary, or if each node cannot fit 4 amplitudes in distributed mode. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00283">283</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;                                                                                                                                                 {</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, controlQubits, numControlQubits, (<span class="keywordtype">int</span>[]) {targetQubit1, targetQubit2}, 2, __func__);</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a>(qureg, u, __func__);</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;    </div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlQubitsMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(controlQubits, numControlQubits);</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a3eadcb581f2623e21e4967f791d0439c">statevec_multiControlledTwoQubitUnitary</a>(qureg, ctrlQubitsMask, targetQubit1, targetQubit2, u);</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a3eadcb581f2623e21e4967f791d0439c">statevec_multiControlledTwoQubitUnitary</a>(qureg, ctrlQubitsMask&lt;&lt;shift, targetQubit1+shift, targetQubit2+shift, <a class="code" href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a>(u));</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;    }</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;    </div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed multi-controlled 2-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00104">getConjugateMatrix4()</a>, <a class="el" href="QuEST__common_8c_source.html#l00044">getQubitBitMask()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01381">statevec_multiControlledTwoQubitUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00423">validateMultiControlsMultiTargets()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00445">validateTwoQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01135">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gaa700dc9657ade4cf16f1cad1624c5332"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa700dc9657ade4cf16f1cad1624c5332">&#9670;&nbsp;</a></span>multiControlledUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiControlledUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>controlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numControlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general multiple-control single-target unitary, which can include a global phase factor. </p>
<p>Any number of control qubits can be specified, and if all have value 1, the given unitary is applied to the target qubit. This effects the many-qubit unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; 1 \\\ &amp; &amp; \ddots \\ &amp; &amp; &amp; u_{00} &amp; u_{01}\\ &amp; &amp; &amp; u_{10} &amp; u_{11} \end{pmatrix} \]" src="form_65.png"/>
</p>
<p> on the control and target qubits. The given 2x2 ComplexMatrix must be unitary, otherwise an error is thrown.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 3) {controls}; \node[draw=none] at (-3.5, 0) {target}; \node[draw=none] at (0, 6) {$\vdots$}; \draw (0, 5) -- (0, 4); \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw (0, 4) -- (0, 2); \draw (-2, 2) -- (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {U}; \end{tikzpicture} } \]" src="form_66.png"/>
</p>
<p><br  />
 </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubits</td><td>applies unitary if all qubits in this array equal 1 </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numControlQubits</td><td>number of control qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>single-qubit unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>numControlQubits</code> is outside [1, <code>qureg.numQubitsRepresented</code>]), or if any qubit index (<code>targetQubit</code> or one in <code>controlQubits</code>) is outside [0, <code>qureg.numQubitsRepresented</code>]), or if any qubit in <code>controlQubits</code> is repeated, or if <code>controlQubits</code> contains <code>targetQubit</code>, or if <code>u</code> is not unitary. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00374">374</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;                                                                                                                      {</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a97f43ad2fe1ffc1f77a9b2af2f5f1cc2">validateMultiControlsTarget</a>(qureg, controlQubits, numControlQubits, targetQubit, __func__);</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;    </div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlQubitsMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(controlQubits, numControlQubits);</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlFlipMask = 0;</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask, ctrlFlipMask, targetQubit, u);</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask&lt;&lt;shift, ctrlFlipMask&lt;&lt;shift, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;    }</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;    </div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a3a79e4305d35f1756b8438bbd34ea6cc">qasm_recordMultiControlledUnitary</a>(qureg, u, controlQubits, numControlQubits, targetQubit);</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00099">getConjugateMatrix2()</a>, <a class="el" href="QuEST__common_8c_source.html#l00044">getQubitBitMask()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00341">qasm_recordMultiControlledUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00997">statevec_multiControlledUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00416">validateMultiControlsTarget()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00441">validateOneQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01239">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga20bf9b8a71b8a3ee4651e9497e6d1f4f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga20bf9b8a71b8a3ee4651e9497e6d1f4f">&#9670;&nbsp;</a></span>multiQubitUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiQubitUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>targs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numTargs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrixN.html">ComplexMatrixN</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general multi-qubit unitary (including a global phase factor) with any number of target qubits. </p>
<p>The first target qubit in <code>targs</code> is treated as <b>least</b> significant in <code>u</code>. For example, </p><pre class="fragment">multiQubitUnitary(qureg, (int []) {a, b, c}, 3, u);
</pre><p>will invoke multiplication </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} u_{00} &amp; u_{01} &amp; u_{02} &amp; u_{03} &amp; u_{04} &amp; u_{05} &amp; u_{06} &amp; u_{07} \\ u_{10} &amp; u_{11} &amp; u_{12} &amp; u_{13} &amp; u_{14} &amp; u_{15} &amp; u_{16} &amp; u_{17} \\ u_{20} &amp; u_{21} &amp; u_{22} &amp; u_{23} &amp; u_{24} &amp; u_{25} &amp; u_{26} &amp; u_{27} \\ u_{30} &amp; u_{31} &amp; u_{32} &amp; u_{33} &amp; u_{34} &amp; u_{35} &amp; u_{36} &amp; u_{37} \\ u_{40} &amp; u_{41} &amp; u_{42} &amp; u_{43} &amp; u_{44} &amp; u_{45} &amp; u_{46} &amp; u_{47} \\ u_{50} &amp; u_{51} &amp; u_{52} &amp; u_{53} &amp; u_{54} &amp; u_{55} &amp; u_{56} &amp; u_{57} \\ u_{60} &amp; u_{61} &amp; u_{62} &amp; u_{63} &amp; u_{64} &amp; u_{65} &amp; u_{66} &amp; u_{67} \\ u_{70} &amp; u_{71} &amp; u_{72} &amp; u_{73} &amp; u_{74} &amp; u_{75} &amp; u_{76} &amp; u_{77} \\ \end{pmatrix} \begin{pmatrix} |cba\rangle = |000\rangle \\ |cba\rangle = |001\rangle \\ |cba\rangle = |010\rangle \\ |cba\rangle = |011\rangle \\ |cba\rangle = |100\rangle \\ |cba\rangle = |101\rangle \\ |cba\rangle = |110\rangle \\ |cba\rangle = |111\rangle \end{pmatrix} \]" src="form_150.png"/>
</p>
<p>The passed ComplexMatrix must be unitary and be a compatible size with the specified number of target qubits, otherwise an error is thrown.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 1) {targets}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-2,2) -- (-1, 2); \draw (1, 2) -- (2, 2); \draw (-1,-1)--(-1,3)--(1,3)--(1,-1); \node[draw=none] at (0, 1) {U}; \node[draw=none] at (0, -1) {$\vdots$}; \end{tikzpicture} } \]" src="form_151.png"/>
</p>
<p>Note that in multithreaded mode, each thread will clone 2^<code>numTargs</code> amplitudes, and store these in the runtime stack. Using t threads, the total memory overhead of this function is t*2^<code>numTargs</code>. For many targets (e.g. 16 qubits), this may cause a stack-overflow / seg-fault (e.g. on a 1 MiB stack).</p>
<p>Note too that in distributed mode, this routine requires that each node contains at least 2^<code>numTargs</code> amplitudes in the register. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q / 2^<code>numTargs</code> nodes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targs</td><td>a list of the target qubits, ordered least significant to most in <code>u</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numTargs</td><td>the number of target qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if any index in <code>targs</code> is outside of [0, <code>qureg.numQubitsRepresented</code>), or if <code>targs</code> are not unique, or if matrix <code>u</code> is not unitary, or if <code>u</code> is not of a compatible size with <code>numTargs</code>, or if a node cannot fit the required number of target amplitudes in distributed mode. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00297">297</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;                                                                                {</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targs, numTargs, __func__);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;    </div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;    <a class="code" href="QuEST__common_8c.html#a7a76950824f17e821415070a4bfdad5b">statevec_multiQubitUnitary</a>(qureg, targs, numTargs, u);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, shift);</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;        <a class="code" href="QuEST__common_8c.html#a7a76950824f17e821415070a4bfdad5b">statevec_multiQubitUnitary</a>(qureg, targs, numTargs, u);</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, -shift);</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;    }</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    </div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed multi-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__common_8c_source.html#l00109">setConjugateMatrixN()</a>, <a class="el" href="QuEST__common_8c_source.html#l00150">shiftIndices()</a>, <a class="el" href="QuEST__common_8c_source.html#l00529">statevec_multiQubitUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00466">validateMultiQubitUnitaryMatrix()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00392">validateMultiTargets()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01310">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga34aa4865c92f9aa5d898c91286c9eca5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga34aa4865c92f9aa5d898c91286c9eca5">&#9670;&nbsp;</a></span>multiRotatePauli()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiRotatePauli </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>targetQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a> *&#160;</td>
          <td class="paramname"><em>targetPaulis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numTargets</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a multi-qubit multi-Pauli rotation on a selected number of qubits. </p>
<p>This is the unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \exp \left( - i \theta/2 \bigotimes_{j} \hat{\sigma}_j\right) \]" src="form_124.png"/>
</p>
<p> where <img class="formulaInl" alt="$\hat{\sigma}_j \in \{X, Y, Z\}$" src="form_125.png"/> is a Pauli operator (indicated by codes 1, 2, 3 respectively in <code>targetPaulis</code>, or by enums PAULI_X, PAULI_Y and PAULI_Z) operating upon the qubit <code>targetQubits</code>[j], and <img class="formulaInl" alt="$\theta$" src="form_16.png"/> is the passed <code>angle</code>. The operators specified in <code>targetPaulis</code> act on the corresponding qubit in <code>targetQubits</code>. For example: </p><pre class="fragment">multiRotatePauli(qureg, (int[]) {4,5,8,9}, (int[]) {0,1,2,3}, 4, .1)
</pre><p>effects </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \exp \left( - i .1/2 X_5 Y_8 Z_9 \right) \]" src="form_126.png"/>
</p>
<p> on <code>qureg</code>, where unspecified qubits (along with those specified with Pauli code 0) are assumed to receive the identity operator (excluded from exponentiation). Note that specifying the identity Pauli (code=0 or PAULI_I) on a qubit is superfluous but allowed for convenience. This is means a global phase factor of <img class="formulaInl" alt="$ exp(-i \theta/2) $" src="form_127.png"/> is NOT induced by supplying 0 pauli-codes. Hence, if all <code>targetPaulis</code> are identity, then this function does nothing to <code>qureg</code>.</p>
<p>This function effects this unitary by first rotating the qubits which are nominated to receive X or Y Paulis into alternate basis, performing multiRotateZ on all target qubits receiving X, Y or Z Paulis, then restoring the original basis. In the worst case, this means that 1+2*<code>numTargets</code> primitive unitaries are performed on the statevector, and double this on density matrices.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubits</td><td>a list of the indices of the target qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetPaulis</td><td>a list of the Pauli codes (0=PAULI_I, 1=PAULI_X, 2=PAULI_Y, 3=PAULI_Z) to apply to the corresponding qubits in <code>targetQubits</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numTargets</td><td>number of target qubits, i.e. the length of <code>targetQubits</code> and <code>targetPaulis</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>the angle by which the multi-qubit state is rotated </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>numQubits</code> is outside [1, <code>qureg.numQubitsRepresented</code>]), or if any qubit in <code>qubits</code> is outside [0, <code>qureg.numQubitsRepresented</code>)) or if any qubit in <code>qubits</code> is repeated. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00642">642</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160;                                                                                                                   {</div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targetQubits, numTargets, __func__);</div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(targetPaulis, numTargets, __func__);</div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160;    </div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;    <span class="keywordtype">int</span> conj=0;</div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;    <a class="code" href="QuEST__common_8c.html#a2153d8611247dd3a2ef483355265cc99">statevec_multiRotatePauli</a>(qureg, targetQubits, targetPaulis, numTargets, angle, conj);</div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;        conj = 1;</div>
<div class="line"><a name="l00650"></a><span class="lineno">  650</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targetQubits, numTargets, shift);</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;        <a class="code" href="QuEST__common_8c.html#a2153d8611247dd3a2ef483355265cc99">statevec_multiRotatePauli</a>(qureg, targetQubits, targetPaulis, numTargets, angle, conj);</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targetQubits, numTargets, -shift);</div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;    }</div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;    </div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;    <span class="comment">// @TODO: create actual QASM</span></div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;        <span class="stringliteral">&quot;Here a %d-qubit multiRotatePauli of angle %g was performed (QASM not yet implemented)&quot;</span>,</div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;        numTargets, angle);</div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__common_8c_source.html#l00150">shiftIndices()</a>, <a class="el" href="QuEST__common_8c_source.html#l00411">statevec_multiRotatePauli()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00392">validateMultiTargets()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00563">validatePauliCodes()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__operators_8cpp_source.html#l00667">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga3250d0d95b5d755cad542a6a2372b894"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3250d0d95b5d755cad542a6a2372b894">&#9670;&nbsp;</a></span>multiRotateZ()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiRotateZ </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>qubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a multi-qubit Z rotation on a selected number of qubits. </p>
<p>This is the unitary </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \exp \left( - i \theta/2 \bigotimes_{j} Z_j\right) \]" src="form_120.png"/>
</p>
<p> where the Pauli Z gates operate upon the passed list <img class="formulaInl" alt="$j \in$" src="form_121.png"/> <code>qubits</code>, and cause rotations of <img class="formulaInl" alt="$\theta =$" src="form_122.png"/> <code>angle</code>. All qubits not appearing in <code>qubits</code> are assumed to receive the identity operator. This has the effect of premultiplying every amplitude with <img class="formulaInl" alt="$\exp(\pm i \theta/2)$" src="form_123.png"/> where the sign is determined by the parity of the target qubits for that amplitude.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">qubits</td><td>a list of the indices of the target qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numQubits</td><td>number of target qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>the angle by which the multi-qubit state is rotated around the Z axis </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>numQubits</code> is outside [1, <code>qureg.numQubitsRepresented</code>]), or if any qubit in <code>qubits</code> is outside [0, <code>qureg.numQubitsRepresented</code>]) or if any qubit in <code>qubits</code> is repeated. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00626">626</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00626"></a><span class="lineno">  626</span>&#160;                                                                        {</div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, qubits, numQubits, __func__);</div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;    </div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> mask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(qubits, numQubits);</div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a8d88b4ed94ab024e5e7b2f1f4f505b44">statevec_multiRotateZ</a>(qureg, mask, angle);</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a8d88b4ed94ab024e5e7b2f1f4f505b44">statevec_multiRotateZ</a>(qureg, mask &lt;&lt; shift, -angle);</div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;    }</div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;    </div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;    <span class="comment">// @TODO: create actual QASM</span></div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;        <span class="stringliteral">&quot;Here a %d-qubit multiRotateZ of angle %g was performed (QASM not yet implemented)&quot;</span>,</div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;        numQubits, angle);</div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00044">getQubitBitMask()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__cpu_8c_source.html#l03109">statevec_multiRotateZ()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00392">validateMultiTargets()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01533">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga41b946a82982c3fa3dc2a7395665bc90"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga41b946a82982c3fa3dc2a7395665bc90">&#9670;&nbsp;</a></span>multiStateControlledUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void multiStateControlledUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>controlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>controlState</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numControlQubits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general multiple-control, conditioned on a specific bit sequence, single-target unitary, which can include a global phase factor. </p>
<p>Any number of control qubits can be specified, along with which of their states (0 or 1) to condition upon; when the specified controls are in the specified state, the given unitary is applied to the target qubit. This is equivalent to NOTing the control bits which are conditioned on 0, calling multiControlledUnitary then NOTing the same control bits.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 3) {controls}; \node[draw=none] at (-3.5, 0) {target}; \node[draw=none] at (0, 6) {$\vdots$}; \draw (0, 5) -- (0, 4); \draw (-2, 4) -- (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw (0, 4) -- (0, 2); \draw (-2, 2) -- (2, 2); \draw[fill=white] (0, 2) circle (.2); \draw (0, 2-.2) -- (0, 1); \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {U}; \end{tikzpicture} } \]" src="form_119.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlQubits</td><td>the indices of the control qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">controlState</td><td>the bit values (0 or 1) of each control qubit, upon which to condition </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">numControlQubits</td><td>number of control qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate the unitary upon </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>single-qubit unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>numControlQubits</code> is outside [1, <code>qureg.numQubitsRepresented</code>]), or if any qubit index (<code>targetQubit</code> or one in <code>controlQubits</code>) is outside [0, <code>qureg.numQubitsRepresented</code>]), or if any qubit in <code>controlQubits</code> is repeated., or if <code>controlQubits</code> contains <code>targetQubit</code>, or if any element of controlState is not a bit (0 or 1), or if <code>u</code> is not unitary. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00389">389</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;                                                                                                                                              {</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a97f43ad2fe1ffc1f77a9b2af2f5f1cc2">validateMultiControlsTarget</a>(qureg, controlQubits, numControlQubits, targetQubit, __func__);</div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0bd6443ea0f5e36738f3b39b72080b6e">validateControlState</a>(controlState, numControlQubits, __func__);</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160; </div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlQubitsMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(controlQubits, numControlQubits);</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlFlipMask = <a class="code" href="QuEST__common_8c.html#a6fa6f1bc617e9fef3cd87ecc3677a02b">getControlFlipMask</a>(controlQubits, controlState, numControlQubits);</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask, ctrlFlipMask, targetQubit, u);</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask&lt;&lt;shift, ctrlFlipMask&lt;&lt;shift, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;    }</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;    </div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9975b6f54f4090cdf851958bc2b37230">qasm_recordMultiStateControlledUnitary</a>(qureg, u, controlQubits, controlState, numControlQubits, targetQubit);</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00099">getConjugateMatrix2()</a>, <a class="el" href="QuEST__common_8c_source.html#l00054">getControlFlipMask()</a>, <a class="el" href="QuEST__common_8c_source.html#l00044">getQubitBitMask()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00362">qasm_recordMultiStateControlledUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00997">statevec_multiControlledUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00432">validateControlState()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00416">validateMultiControlsTarget()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00441">validateOneQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01607">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga4193c14cfb918fa3291fb0648058d63e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4193c14cfb918fa3291fb0648058d63e">&#9670;&nbsp;</a></span>pauliX()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void pauliX </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the single-qubit Pauli-X (also known as the X, sigma-X, NOT or bit-flip) gate. </p>
<p>This is a rotation of <img class="formulaInl" alt="$\pi$" src="form_67.png"/> around the x-axis on the Bloch sphere. I.e. </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 0 &amp; 1 \\ 1 &amp; 0 \end{pmatrix} \]" src="form_68.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (2, 0); \draw (0, 0) circle (.5); \draw (0, .5) -- (0, -.5); \end{tikzpicture} } \]" src="form_69.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00433">433</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;                                          {</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;    </div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;    }</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;    </div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55">GATE_SIGMA_X</a>, targetQubit);</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00021">GATE_SIGMA_X</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00178">qasm_recordGate()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01034">statevec_pauliX()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01716">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga8e0f03e745778a89d6f59c3c25e32df8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8e0f03e745778a89d6f59c3c25e32df8">&#9670;&nbsp;</a></span>pauliY()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void pauliY </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the single-qubit Pauli-Y (also known as the Y or sigma-Y) gate. </p>
<p>This is a rotation of <img class="formulaInl" alt="$\pi$" src="form_67.png"/> around the Y-axis on the Bloch sphere. I.e. </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 0 &amp; -i \\ i &amp; 0 \end{pmatrix} \]" src="form_70.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$\sigma_y$}; \end{tikzpicture} } \]" src="form_71.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00444">444</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;                                          {</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;    </div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;    <a class="code" href="QuEST__internal_8h.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">statevec_pauliY</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">statevec_pauliYConj</a>(qureg, targetQubit + qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;    }</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;    </div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b">GATE_SIGMA_Y</a>, targetQubit);</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00022">GATE_SIGMA_Y</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00178">qasm_recordGate()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01090">statevec_pauliY()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01115">statevec_pauliYConj()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01755">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga5d80b490e3910aa737a81bb597cdfcc9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5d80b490e3910aa737a81bb597cdfcc9">&#9670;&nbsp;</a></span>pauliZ()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void pauliZ </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the single-qubit Pauli-Z (also known as the Z, sigma-Z or phase-flip) gate. </p>
<p>This is a rotation of <img class="formulaInl" alt="$\pi$" src="form_67.png"/> around the Z-axis (a phase shift) on the Bloch sphere. I.e. </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 &amp; 0 \\ 0 &amp; -1 \end{pmatrix} \]" src="form_72.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$\sigma_z$}; \end{tikzpicture} } \]" src="form_73.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00455">455</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;                                          {</div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;    </div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;    <a class="code" href="QuEST__common_8c.html#ab14df201e5c05527dc77cfeb6f583042">statevec_pauliZ</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;        <a class="code" href="QuEST__common_8c.html#ab14df201e5c05527dc77cfeb6f583042">statevec_pauliZ</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;    }</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;    </div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a>, targetQubit);</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00023">GATE_SIGMA_Z</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00178">qasm_recordGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00258">statevec_pauliZ()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01794">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga26baa057f5db8804825c2d611386753b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga26baa057f5db8804825c2d611386753b">&#9670;&nbsp;</a></span>phaseShift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void phaseShift </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Shift the phase between <img class="formulaInl" alt="$ |0\rangle $" src="form_14.png"/> and <img class="formulaInl" alt="$ |1\rangle $" src="form_15.png"/> of a single qubit by a given angle. </p>
<p>This is equivalent to a rotation Z-axis of the Bloch-sphere up to a global phase factor. For angle <img class="formulaInl" alt="$\theta$" src="form_16.png"/>, applies </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 &amp; 0 \\ 0 &amp; \exp(i \theta) \end{pmatrix} \]" src="form_17.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {rot}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_\theta$}; \end{tikzpicture} } \]" src="form_18.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to undergo a phase shift </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>amount by which to shift the phase in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00488">488</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;                                                           {</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;    </div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;    <a class="code" href="QuEST__common_8c.html#a5ef139196852f92fe8271c82964eadff">statevec_phaseShift</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;        <a class="code" href="QuEST__common_8c.html#a5ef139196852f92fe8271c82964eadff">statevec_phaseShift</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, -angle);</div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;    }</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;    </div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a>, targetQubit, angle);</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00032">GATE_PHASE_SHIFT</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00186">qasm_recordParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00251">statevec_phaseShift()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01833">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga4c708f066b244801e10f538b48b90145"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4c708f066b244801e10f538b48b90145">&#9670;&nbsp;</a></span>rotateAroundAxis()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rotateAroundAxis </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>rotQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structVector.html">Vector</a>&#160;</td>
          <td class="paramname"><em>axis</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Rotate a single qubit by a given angle around a given <a class="el" href="structVector.html">Vector</a> on the Bloch-sphere. </p>
<p><br  />
 The vector must not be zero (else an error is thrown), but needn't be unit magnitude, since it will be normalised by QuEST.</p>
<p>For angle <img class="formulaInl" alt="$\theta$" src="form_16.png"/> and axis vector <img class="formulaInl" alt="$\vec{n}$" src="form_54.png"/>, applies <img class="formulaInl" alt="$R_{\hat{n}} = \exp \left(- i \frac{\theta}{2} \hat{n} \cdot \vec{\sigma} \right) $" src="form_55.png"/> where <img class="formulaInl" alt="$\vec{\sigma}$" src="form_56.png"/> is the vector of Pauli matrices.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">rotQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate in radians </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">axis</td><td>vector around which to rotate (can be non-unit; will be normalised) </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>rotQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>), or if <code>axis</code> is the zero vector </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00575">575</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;                                                                           {</div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, rotQubit, __func__);</div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a782c6f57939eeb72b7be8e247979f3be">validateVector</a>(axis, __func__);</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;    </div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;    <a class="code" href="QuEST__common_8c.html#adf5fbea75826cde7d86fd7c31bcf3dec">statevec_rotateAroundAxis</a>(qureg, rotQubit, angle, axis);</div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;        <a class="code" href="QuEST__common_8c.html#a2cbfe9f416d4d8acb56213841f62cb53">statevec_rotateAroundAxisConj</a>(qureg, rotQubit+shift, angle, axis);</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;    }</div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;    </div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a42607270d63948acf84d6def787213e8">qasm_recordAxisRotation</a>(qureg, angle, axis, rotQubit);</div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00223">qasm_recordAxisRotation()</a>, <a class="el" href="QuEST__common_8c_source.html#l00311">statevec_rotateAroundAxis()</a>, <a class="el" href="QuEST__common_8c_source.html#l00318">statevec_rotateAroundAxisConj()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00475">validateVector()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01873">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga8886a3793b21622c48cf3bad6e15082d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8886a3793b21622c48cf3bad6e15082d">&#9670;&nbsp;</a></span>rotateX()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rotateX </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>rotQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Rotate a single qubit by a given angle around the X-axis of the Bloch-sphere. </p>
<p>For angle <img class="formulaInl" alt="$\theta$" src="form_16.png"/>, applies </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} \cos\theta/2 &amp; -i \sin \theta/2\\ -i \sin \theta/2 &amp; \cos \theta/2 \end{pmatrix} \]" src="form_48.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {rot}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_x(\theta)$}; \end{tikzpicture} } \]" src="form_49.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">rotQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>rotQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00188">188</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;                                                        {</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    </div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <a class="code" href="QuEST__common_8c.html#ab8687e6ea5cf35503c223051837f3b94">statevec_rotateX</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;        <a class="code" href="QuEST__common_8c.html#ab8687e6ea5cf35503c223051837f3b94">statevec_rotateX</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, -angle);</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    }</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    </div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361">GATE_ROTATE_X</a>, targetQubit, angle);</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00027">GATE_ROTATE_X</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00186">qasm_recordParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00293">statevec_rotateX()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01929">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga34312ff52cc28bcab3cbd2ff338fd081"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga34312ff52cc28bcab3cbd2ff338fd081">&#9670;&nbsp;</a></span>rotateY()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rotateY </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>rotQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Rotate a single qubit by a given angle around the Y-axis of the Bloch-sphere. </p>
<p>For angle <img class="formulaInl" alt="$\theta$" src="form_16.png"/>, applies </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} \cos\theta/2 &amp; - \sin \theta/2\\ \sin \theta/2 &amp; \cos \theta/2 \end{pmatrix} \]" src="form_50.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {rot}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_y(\theta)$}; \end{tikzpicture} } \]" src="form_51.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">rotQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>rotQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc, debug) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00199">199</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;                                                        {</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    </div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <a class="code" href="QuEST__common_8c.html#a1f0db2800d13b6c2b120e05129cd13cb">statevec_rotateY</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        <a class="code" href="QuEST__common_8c.html#a1f0db2800d13b6c2b120e05129cd13cb">statevec_rotateY</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, angle);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    }</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;    </div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689">GATE_ROTATE_Y</a>, targetQubit, angle);</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00028">GATE_ROTATE_Y</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00186">qasm_recordParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00299">statevec_rotateY()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l01969">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gab23a8b022ec83b9d423961ca87cd8cb5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab23a8b022ec83b9d423961ca87cd8cb5">&#9670;&nbsp;</a></span>rotateZ()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rotateZ </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>rotQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>&#160;</td>
          <td class="paramname"><em>angle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Rotate a single qubit by a given angle around the Z-axis of the Bloch-sphere (also known as a phase shift gate). </p>
<p><br  />
 For angle <img class="formulaInl" alt="$\theta$" src="form_16.png"/>, applies </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} \exp(-i \theta/2) &amp; 0 \\ 0 &amp; \exp(i \theta/2) \end{pmatrix} \]" src="form_52.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {rot}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {$R_z(\theta)$}; \end{tikzpicture} } \]" src="form_53.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">rotQubit</td><td>qubit to rotate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">angle</td><td>angle by which to rotate in radians </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>rotQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00210">210</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;                                                        {</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    </div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    <a class="code" href="QuEST__common_8c.html#a2b2b8c69566a49cdf4a3fa2cb4f5e03c">statevec_rotateZ</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;        <a class="code" href="QuEST__common_8c.html#a2b2b8c69566a49cdf4a3fa2cb4f5e03c">statevec_rotateZ</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, -angle);</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    }</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    </div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877">GATE_ROTATE_Z</a>, targetQubit, angle);</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00029">GATE_ROTATE_Z</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00186">qasm_recordParamGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00305">statevec_rotateZ()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l02009">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga655ffcd4def2e127341c9488f5ca8455"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga655ffcd4def2e127341c9488f5ca8455">&#9670;&nbsp;</a></span>sGate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sGate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the single-qubit S gate. </p>
<p>This is a rotation of <img class="formulaInl" alt="$\pi/2$" src="form_29.png"/> around the Z-axis on the Bloch sphere, or the unitary: </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 &amp; 0 \\ 0 &amp; i \end{pmatrix} \]" src="form_30.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {S}; \end{tikzpicture} } \]" src="form_31.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate upon </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00466">466</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;                                         {</div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;    </div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;    <a class="code" href="QuEST__common_8c.html#a559d175d31cec552fc09aec3e8a78d11">statevec_sGate</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;        <a class="code" href="QuEST__common_8c.html#a142b424d903dfaca7a7ac166076f543a">statevec_sGateConj</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;    }</div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;    </div>
<div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa5053f3d968443bc04e8b1d09f18bab9a">GATE_S</a>, targetQubit);</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00025">GATE_S</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00178">qasm_recordGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00265">statevec_sGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00279">statevec_sGateConj()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l02049">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga75d5e65f87c68403602a669b9c6d52b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga75d5e65f87c68403602a669b9c6d52b0">&#9670;&nbsp;</a></span>sqrtSwapGate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sqrtSwapGate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>qb1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>qb2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a sqrt SWAP gate between <code>qubit1</code> and <code>qubit2</code>. </p>
<p>This effects </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; \frac{1}{2}(1+i) &amp; \frac{1}{2}(1-i) \\\ &amp; \frac{1}{2}(1-i) &amp; \frac{1}{2}(1+i) \\ &amp; &amp; &amp; 1 \end{pmatrix} \]" src="form_117.png"/>
</p>
<p> on the designated qubits, though is performed internally by three CNOT gates.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {qubit1}; \node[draw=none] at (-3.5, 0) {qubit2}; \draw (-2, 2) -- (2, 2); \draw (0, 2) -- (0, 0); \draw (-2,0) -- (2, 0); \draw (-.35,-.35) -- (.35,.35); \draw (-.35,.35) -- (.35,-.35); \draw (-.35,-.35 + 2) -- (.35,.35 + 2); \draw (-.35,.35 + 2) -- (.35,-.35 + 2); \draw[fill=white] (0, 1) circle (.5); \node[draw=none] at (0, 1) {1/2}; \end{tikzpicture} } \]" src="form_118.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">qubit1</td><td>qubit to sqrt swap </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">qubit2</td><td>other qubit to sqrt swap </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>qubit1</code> or <code>qubit2</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or are equal. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00613">613</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160;                                                 {</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a>(qureg, qb1, qb2, __func__);</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa28b7d9c0c3cf9c4be0e324fb9d6bf76">validateMultiQubitMatrixFitsInNode</a>(qureg, 2, __func__); <span class="comment">// uses 2qb unitary in QuEST_common</span></div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160; </div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;    <a class="code" href="QuEST__common_8c.html#a6550462400942be61b171c8840b36aa1">statevec_sqrtSwapGate</a>(qureg, qb1, qb2);</div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;        <a class="code" href="QuEST__common_8c.html#a33cde9b6518d55a544eff20301a5d844">statevec_sqrtSwapGateConj</a>(qureg, qb1+shift, qb2+shift);</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;    }</div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160; </div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab656861dfb036cbcf7009f02a8949253">GATE_SQRT_SWAP</a>, qb1, qb2);</div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00034">GATE_SQRT_SWAP</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00238">qasm_recordControlledGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00384">statevec_sqrtSwapGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00397">statevec_sqrtSwapGateConj()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00437">validateMultiQubitMatrixFitsInNode()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00378">validateUniqueTargets()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l02088">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga820fd139c035136819e371308c206e36"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga820fd139c035136819e371308c206e36">&#9670;&nbsp;</a></span>swapGate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void swapGate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>qubit1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>qubit2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a SWAP gate between <code>qubit1</code> and <code>qubit2</code>. </p>
<p>This effects </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 \\ &amp; &amp; 1 \\\ &amp; 1 \\ &amp; &amp; &amp; 1 \end{pmatrix} \]" src="form_115.png"/>
</p>
<p> on the designated qubits, though is performed internally by three CNOT gates.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {qubit1}; \node[draw=none] at (-3.5, 0) {qubit2}; \draw (-2, 2) -- (2, 2); \draw (0, 2) -- (0, 0); \draw (-2,0) -- (2, 0); \draw (-.35,-.35) -- (.35,.35); \draw (-.35,.35) -- (.35,-.35); \draw (-.35,-.35 + 2) -- (.35,.35 + 2); \draw (-.35,.35 + 2) -- (.35,-.35 + 2); \end{tikzpicture} } \]" src="form_116.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">qubit1</td><td>qubit to swap </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">qubit2</td><td>other qubit to swap </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if either <code>qubit1</code> or <code>qubit2</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or are equal. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00601">601</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;                                             {</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a>(qureg, qb1, qb2, __func__);</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160; </div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a>(qureg, qb1, qb2);</div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;        <a class="code" href="QuEST__internal_8h.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a>(qureg, qb1+shift, qb2+shift);</div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;    }</div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160; </div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab12d052de2b7c59c6ab87710fd7d3c78">GATE_SWAP</a>, qb1, qb2);</div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00033">GATE_SWAP</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00238">qasm_recordControlledGate()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01354">statevec_swapQubitAmps()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00378">validateUniqueTargets()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l02138">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gac15907193da5a7c48b9610a26e669064"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac15907193da5a7c48b9610a26e669064">&#9670;&nbsp;</a></span>tGate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tGate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply the single-qubit T gate. </p>
<p>This is a rotation of <img class="formulaInl" alt="$\pi/4$" src="form_32.png"/> around the Z-axis on the Bloch sphere, or the unitary: </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} 1 &amp; 0 \\ 0 &amp; \exp\left(i \frac{\pi}{4}\right) \end{pmatrix} \]" src="form_33.png"/>
</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {T}; \end{tikzpicture} } \]" src="form_34.png"/>
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate upon </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00477">477</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;                                         {</div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;    </div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;    <a class="code" href="QuEST__common_8c.html#a2d96b4601cc3a9e1221e11a366fe1699">statevec_tGate</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;        <a class="code" href="QuEST__common_8c.html#a086fffa88b1aeec1405aa2dc41eab8a3">statevec_tGateConj</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;    }</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;    </div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fadfa058950331ffdba0bf56cb2272e01f">GATE_T</a>, targetQubit);</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__qasm_8h_source.html#l00024">GATE_T</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00178">qasm_recordGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00272">statevec_tGate()</a>, <a class="el" href="QuEST__common_8c_source.html#l00286">statevec_tGateConj()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l02186">TEST_CASE()</a>.</p>

</div>
</div>
<a id="gab525a42d63233f61afeb6be97d89dd36"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab525a42d63233f61afeb6be97d89dd36">&#9670;&nbsp;</a></span>twoQubitUnitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void twoQubitUnitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrix4.html">ComplexMatrix4</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general two-qubit unitary (including a global phase factor). </p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target2}; \node[draw=none] at (-3.5, 2) {target1}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-2,2) -- (-1, 2); \draw (1, 2) -- (2, 2); \draw (-1,-1)--(-1,3)--(1,3)--(1,-1)--cycle; \node[draw=none] at (0, 1) {U}; \end{tikzpicture} } \]" src="form_143.png"/>
</p>
<p><code>targetQubit1</code> is treated as the <code>least</code> significant qubit in <code>u</code>, such that a row in <code>u</code> is dotted with the vector <img class="formulaInl" alt="$ |\text{targetQubit2} \;\; \text{targetQubit1}\rangle : \{ |00\rangle, |01\rangle, |10\rangle, |11\rangle \} $" src="form_144.png"/></p>
<p>For example, </p><pre class="fragment">twoQubitUnitary(qureg, a, b, u);
</pre><p>will invoke multiplication </p><p class="formulaDsp">
<img class="formulaDsp" alt="\[ \begin{pmatrix} u_{00} &amp; u_{01} &amp; u_{02} &amp; u_{03} \\ u_{10} &amp; u_{11} &amp; u_{12} &amp; u_{13} \\ u_{20} &amp; u_{21} &amp; u_{22} &amp; u_{23} \\ u_{30} &amp; u_{31} &amp; u_{32} &amp; u_{33} \end{pmatrix} \begin{pmatrix} |ba\rangle = |00\rangle \\ |ba\rangle = |01\rangle \\ |ba\rangle = |10\rangle \\ |ba\rangle = |11\rangle \end{pmatrix} \]" src="form_145.png"/>
</p>
<p>The passed 4x4 ComplexMatrix must be unitary, otherwise an error is thrown.</p>
<p>Note that in distributed mode, this routine requires that each node contains at least 4 amplitudes. This means an q-qubit register (state vector or density matrix) can be distributed by at most 2^q/4 nodes.</p>
<p><br  />
 </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit1</td><td>first qubit to operate on, treated as least significant in <code>u</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit2</td><td>second qubit to operate on, treated as most significant in <code>u</code> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit1</code> or <code>targetQubit2</code> are outside [0, <code>qureg.numQubitsRepresented</code>), or if <code>targetQubit1</code> equals <code>targetQubit2</code>, or matrix <code>u</code> is not unitary, or if each node cannot fit 4 amplitudes in distributed mode. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Tyson Jones </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00257">257</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;                                                                                        {</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, (<span class="keywordtype">int</span> []) {targetQubit1, targetQubit2}, 2, __func__);</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a>(qureg, u, __func__);</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    </div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    <a class="code" href="QuEST__common_8c.html#a95abbe0cedf45b1ff2f070dba219fd7f">statevec_twoQubitUnitary</a>(qureg, targetQubit1, targetQubit2, u);</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        <a class="code" href="QuEST__common_8c.html#a95abbe0cedf45b1ff2f070dba219fd7f">statevec_twoQubitUnitary</a>(qureg, targetQubit1+shift, targetQubit2+shift, <a class="code" href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a>(u));</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    }</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    </div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed 2-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00104">getConjugateMatrix4()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00120">qasm_recordComment()</a>, <a class="el" href="QuEST__common_8c_source.html#l00517">statevec_twoQubitUnitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00392">validateMultiTargets()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00445">validateTwoQubitUnitaryMatrix()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l02225">TEST_CASE()</a>.</p>

</div>
</div>
<a id="ga78b814256f851cac70fdf3cbf9cfc206"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga78b814256f851cac70fdf3cbf9cfc206">&#9670;&nbsp;</a></span>unitary()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void unitary </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structQureg.html">Qureg</a>&#160;</td>
          <td class="paramname"><em>qureg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>targetQubit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a>&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply a general single-qubit unitary (including a global phase factor). </p>
<p>The passed 2x2 ComplexMatrix must be unitary, otherwise an error is thrown.</p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ \setlength{\fboxrule}{0.01pt} \fbox{ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 0) {target}; \draw (-2,0) -- (-1, 0); \draw (1, 0) -- (2, 0); \draw (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; \node[draw=none] at (0, 0) {U}; \end{tikzpicture} } \]" src="form_45.png"/>
</p>
<p>If <code>qureg</code> is a state-vector, then the resulting state is <img class="formulaInl" alt="$ u \, |\text{qureg}\rangle $" src="form_46.png"/>. If <code>qureg</code> is a density-matrix <img class="formulaInl" alt="$ \rho $" src="form_39.png"/>, then the resulting state is <img class="formulaInl" alt="$ u \, \rho \, u^\dagger $" src="form_47.png"/>.</p>
<p><br  />
 </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">qureg</td><td>object representing the set of all qubits </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit to operate on </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u</td><td>unitary matrix to apply </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">invalidQuESTInputError</td><td>if <code>targetQubit</code> is outside [0, <code>qureg.numQubitsRepresented</code>), or matrix <code>u</code> is not unitary. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section author"><dt>Author</dt><dd>Ania Brown (state-vector) </dd>
<dd>
Tyson Jones (density matrix, doc) </dd></dl>

<p class="definition">Definition at line <a class="el" href="QuEST_8c_source.html#l00349">349</a> of file <a class="el" href="QuEST_8c_source.html">QuEST.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;                                                             {</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;    </div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a>(qureg, targetQubit, u);</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;        <a class="code" href="QuEST__internal_8h.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    }</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    </div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ad22260712869e79f07d2f04e2b41a233">qasm_recordUnitary</a>(qureg, u, targetQubit);</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__common_8c_source.html#l00099">getConjugateMatrix2()</a>, <a class="el" href="QuEST_8h_source.html#l00206">Qureg::isDensityMatrix</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST__qasm_8c_source.html#l00207">qasm_recordUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00881">statevec_unitary()</a>, <a class="el" href="QuEST__validation_8c_source.html#l00441">validateOneQubitUnitaryMatrix()</a>, and <a class="el" href="QuEST__validation_8c_source.html#l00364">validateTarget()</a>.</p>

<p class="reference">Referenced by <a class="el" href="test__unitaries_8cpp_source.html#l02290">TEST_CASE()</a>.</p>

</div>
</div>
</div><!-- contents -->
<div class="ttc" id="aQuEST__common_8c_html_a5ef139196852f92fe8271c82964eadff"><div class="ttname"><a href="QuEST__common_8c.html#a5ef139196852f92fe8271c82964eadff">statevec_phaseShift</a></div><div class="ttdeci">void statevec_phaseShift(Qureg qureg, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00251">QuEST_common.c:251</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a97f43ad2fe1ffc1f77a9b2af2f5f1cc2"><div class="ttname"><a href="QuEST__validation_8c.html#a97f43ad2fe1ffc1f77a9b2af2f5f1cc2">validateMultiControlsTarget</a></div><div class="ttdeci">void validateMultiControlsTarget(Qureg qureg, int *controlQubits, int numControlQubits, int targetQubit, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00416">QuEST_validation.c:416</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a559d175d31cec552fc09aec3e8a78d11"><div class="ttname"><a href="QuEST__common_8c.html#a559d175d31cec552fc09aec3e8a78d11">statevec_sGate</a></div><div class="ttdeci">void statevec_sGate(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00265">QuEST_common.c:265</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ab14df201e5c05527dc77cfeb6f583042"><div class="ttname"><a href="QuEST__common_8c.html#ab14df201e5c05527dc77cfeb6f583042">statevec_pauliZ</a></div><div class="ttdeci">void statevec_pauliZ(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00258">QuEST_common.c:258</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ab8687e6ea5cf35503c223051837f3b94"><div class="ttname"><a href="QuEST__common_8c.html#ab8687e6ea5cf35503c223051837f3b94">statevec_rotateX</a></div><div class="ttdeci">void statevec_rotateX(Qureg qureg, int rotQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00293">QuEST_common.c:293</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ac31c45c5a31c523be0eb26abba6cf598"><div class="ttname"><a href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a></div><div class="ttdeci">void validateTarget(Qureg qureg, int targetQubit, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00364">QuEST_validation.c:364</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_aabeb3e9ec6b2f30938c4cf9592e624fa"><div class="ttname"><a href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a></div><div class="ttdeci">void qasm_recordParamGate(Qureg qureg, TargetGate gate, int targetQubit, qreal param)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00186">QuEST_qasm.c:186</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_acf1c651a4359a370a2d9b3e1e1ebd430"><div class="ttname"><a href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a></div><div class="ttdeci">void shiftIndices(int *indices, int numIndices, int shift)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00150">QuEST_common.c:150</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ad7ac4934371d72e24c6d1cea3d3da391"><div class="ttname"><a href="QuEST__common_8c.html#ad7ac4934371d72e24c6d1cea3d3da391">statevec_controlledTwoQubitUnitary</a></div><div class="ttdeci">void statevec_controlledTwoQubitUnitary(Qureg qureg, int controlQubit, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00523">QuEST_common.c:523</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fadfa058950331ffdba0bf56cb2272e01f"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fadfa058950331ffdba0bf56cb2272e01f">GATE_T</a></div><div class="ttdeci">@ GATE_T</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00024">QuEST_qasm.h:24</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a></div><div class="ttdeci">@ GATE_PHASE_SHIFT</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00032">QuEST_qasm.h:32</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_ad22260712869e79f07d2f04e2b41a233"><div class="ttname"><a href="QuEST__qasm_8c.html#ad22260712869e79f07d2f04e2b41a233">qasm_recordUnitary</a></div><div class="ttdeci">void qasm_recordUnitary(Qureg qureg, ComplexMatrix2 u, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00207">QuEST_qasm.c:207</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_abecd71c919a35e5a87b07ba400edc7c2"><div class="ttname"><a href="QuEST__qasm_8c.html#abecd71c919a35e5a87b07ba400edc7c2">qasm_recordMultiControlledGate</a></div><div class="ttdeci">void qasm_recordMultiControlledGate(Qureg qureg, TargetGate gate, int *controlQubits, int numControlQubits, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00316">QuEST_qasm.c:316</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aa28b7d9c0c3cf9c4be0e324fb9d6bf76"><div class="ttname"><a href="QuEST__validation_8c.html#aa28b7d9c0c3cf9c4be0e324fb9d6bf76">validateMultiQubitMatrixFitsInNode</a></div><div class="ttdeci">void validateMultiQubitMatrixFitsInNode(Qureg qureg, int numTargets, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00437">QuEST_validation.c:437</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a95abbe0cedf45b1ff2f070dba219fd7f"><div class="ttname"><a href="QuEST__common_8c.html#a95abbe0cedf45b1ff2f070dba219fd7f">statevec_twoQubitUnitary</a></div><div class="ttdeci">void statevec_twoQubitUnitary(Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00517">QuEST_common.c:517</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a086fffa88b1aeec1405aa2dc41eab8a3"><div class="ttname"><a href="QuEST__common_8c.html#a086fffa88b1aeec1405aa2dc41eab8a3">statevec_tGateConj</a></div><div class="ttdeci">void statevec_tGateConj(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00286">QuEST_common.c:286</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ac3735bd959600e57b2ee3a105666cddf"><div class="ttname"><a href="QuEST__internal_8h.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a></div><div class="ttdeci">void statevec_unitary(Qureg qureg, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00881">QuEST_cpu_distributed.c:881</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a20d45e85dd49dd3bf6045990b590b24b"><div class="ttname"><a href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a></div><div class="ttdeci">ComplexMatrix4 getConjugateMatrix4(ComplexMatrix4 src)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00104">QuEST_common.c:104</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361">GATE_ROTATE_X</a></div><div class="ttdeci">@ GATE_ROTATE_X</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00027">QuEST_qasm.h:27</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ab9947ff071a0c019f715f04b3833dcfd"><div class="ttname"><a href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a></div><div class="ttdeci">void validateMultiQubitUnitaryMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00466">QuEST_validation.c:466</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a0acfe30083d0bc2a84da196378a36122"><div class="ttname"><a href="QuEST__internal_8h.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a></div><div class="ttdeci">void statevec_multiControlledMultiQubitUnitary(Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01437">QuEST_cpu_distributed.c:1437</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a8d88b4ed94ab024e5e7b2f1f4f505b44"><div class="ttname"><a href="QuEST__internal_8h.html#a8d88b4ed94ab024e5e7b2f1f4f505b44">statevec_multiRotateZ</a></div><div class="ttdeci">void statevec_multiRotateZ(Qureg qureg, long long int mask, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03109">QuEST_cpu.c:3109</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a6bd68fa9c0c1bd9c9f9af714ea0b8b03"><div class="ttname"><a href="QuEST__qasm_8c.html#a6bd68fa9c0c1bd9c9f9af714ea0b8b03">qasm_recordControlledCompactUnitary</a></div><div class="ttdeci">void qasm_recordControlledCompactUnitary(Qureg qureg, Complex alpha, Complex beta, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00264">QuEST_qasm.c:264</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877">GATE_ROTATE_Z</a></div><div class="ttdeci">@ GATE_ROTATE_Z</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00029">QuEST_qasm.h:29</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a></div><div class="ttdeci">@ GATE_SIGMA_Z</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00023">QuEST_qasm.h:23</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a4e19ef93d01d7acea32ca646d623aedd"><div class="ttname"><a href="QuEST__internal_8h.html#a4e19ef93d01d7acea32ca646d623aedd">statevec_controlledPauliY</a></div><div class="ttdeci">void statevec_controlledPauliY(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01140">QuEST_cpu_distributed.c:1140</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_af92fa737f4491324408b3d15543dced4"><div class="ttname"><a href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a></div><div class="ttdeci">Complex getConjugateScalar(Complex scalar)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00085">QuEST_common.c:85</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a63df1ec14ff7cc81c3f392ac10fcc744"><div class="ttname"><a href="QuEST__internal_8h.html#a63df1ec14ff7cc81c3f392ac10fcc744">statevec_controlledPhaseShift</a></div><div class="ttdeci">void statevec_controlledPhaseShift(Qureg qureg, int idQubit1, int idQubit2, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03019">QuEST_cpu.c:3019</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa8417e56d80add49216437e0d451e8dd9"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa8417e56d80add49216437e0d451e8dd9">GATE_HADAMARD</a></div><div class="ttdeci">@ GATE_HADAMARD</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00026">QuEST_qasm.h:26</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ad34d98eeaa6a3cb45e92c696cfd2d1c8"><div class="ttname"><a href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a></div><div class="ttdeci">ComplexMatrix2 getConjugateMatrix2(ComplexMatrix2 src)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00099">QuEST_common.c:99</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aa662796ea6e0f471143c53becae8c12c"><div class="ttname"><a href="QuEST__internal_8h.html#aa662796ea6e0f471143c53becae8c12c">statevec_multiControlledPhaseShift</a></div><div class="ttdeci">void statevec_multiControlledPhaseShift(Qureg qureg, int *controlQubits, int numControlQubits, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03059">QuEST_cpu.c:3059</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_af1cca787f3b0e0c91ffb2495f9ad8d5a"><div class="ttname"><a href="QuEST__internal_8h.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">statevec_pauliY</a></div><div class="ttdeci">void statevec_pauliY(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01090">QuEST_cpu_distributed.c:1090</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a06b8474aec51579ff680fb66439e7fc6"><div class="ttname"><a href="QuEST__common_8c.html#a06b8474aec51579ff680fb66439e7fc6">statevec_controlledMultiQubitUnitary</a></div><div class="ttdeci">void statevec_controlledMultiQubitUnitary(Qureg qureg, int ctrl, int *targets, int numTargets, ComplexMatrixN u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00535">QuEST_common.c:535</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a9975b6f54f4090cdf851958bc2b37230"><div class="ttname"><a href="QuEST__qasm_8c.html#a9975b6f54f4090cdf851958bc2b37230">qasm_recordMultiStateControlledUnitary</a></div><div class="ttdeci">void qasm_recordMultiStateControlledUnitary(Qureg qureg, ComplexMatrix2 u, int *controlQubits, int *controlState, int numControlQubits, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00362">QuEST_qasm.c:362</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a6550462400942be61b171c8840b36aa1"><div class="ttname"><a href="QuEST__common_8c.html#a6550462400942be61b171c8840b36aa1">statevec_sqrtSwapGate</a></div><div class="ttdeci">void statevec_sqrtSwapGate(Qureg qureg, int qb1, int qb2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00384">QuEST_common.c:384</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ab7478fcaf6357ab202d72853b672e375"><div class="ttname"><a href="QuEST__internal_8h.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a></div><div class="ttdeci">void statevec_swapQubitAmps(Qureg qureg, int qb1, int qb2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01354">QuEST_cpu_distributed.c:1354</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a4a2fa262d3f0dba372797b9bd35d9fa5"><div class="ttname"><a href="QuEST__internal_8h.html#a4a2fa262d3f0dba372797b9bd35d9fa5">statevec_controlledPauliYConj</a></div><div class="ttdeci">void statevec_controlledPauliYConj(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01173">QuEST_cpu_distributed.c:1173</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a782c6f57939eeb72b7be8e247979f3be"><div class="ttname"><a href="QuEST__validation_8c.html#a782c6f57939eeb72b7be8e247979f3be">validateVector</a></div><div class="ttdeci">void validateVector(Vector vec, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00475">QuEST_validation.c:475</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a9e7e85cfc36e3ce1f456a840a217bfd9"><div class="ttname"><a href="QuEST__validation_8c.html#a9e7e85cfc36e3ce1f456a840a217bfd9">validateMultiQubits</a></div><div class="ttdeci">void validateMultiQubits(Qureg qureg, int *qubits, int numQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00408">QuEST_validation.c:408</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_add9ca9956cdd81ed5d0b0f66168c04a3"><div class="ttname"><a href="QuEST__internal_8h.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a></div><div class="ttdeci">void statevec_controlledUnitary(Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00958">QuEST_cpu_distributed.c:958</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_aa4c380db9eda18892d5a86825fa4b165"><div class="ttname"><a href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a></div><div class="ttdeci">void qasm_recordControlledGate(Qureg qureg, TargetGate gate, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00238">QuEST_qasm.c:238</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aefc4a3a9cdb71f6e63bc58ad600e420e"><div class="ttname"><a href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a></div><div class="ttdeci">void validateControlTarget(Qureg qureg, int controlQubit, int targetQubit, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00372">QuEST_validation.c:372</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a42607270d63948acf84d6def787213e8"><div class="ttname"><a href="QuEST__qasm_8c.html#a42607270d63948acf84d6def787213e8">qasm_recordAxisRotation</a></div><div class="ttdeci">void qasm_recordAxisRotation(Qureg qureg, qreal angle, Vector axis, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00223">QuEST_qasm.c:223</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fab656861dfb036cbcf7009f02a8949253"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab656861dfb036cbcf7009f02a8949253">GATE_SQRT_SWAP</a></div><div class="ttdeci">@ GATE_SQRT_SWAP</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00034">QuEST_qasm.h:34</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55">GATE_SIGMA_X</a></div><div class="ttdeci">@ GATE_SIGMA_X</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00021">QuEST_qasm.h:21</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2d96b4601cc3a9e1221e11a366fe1699"><div class="ttname"><a href="QuEST__common_8c.html#a2d96b4601cc3a9e1221e11a366fe1699">statevec_tGate</a></div><div class="ttdeci">void statevec_tGate(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00272">QuEST_common.c:272</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a0bd6443ea0f5e36738f3b39b72080b6e"><div class="ttname"><a href="QuEST__validation_8c.html#a0bd6443ea0f5e36738f3b39b72080b6e">validateControlState</a></div><div class="ttdeci">void validateControlState(int *controlState, int numControlQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00432">QuEST_validation.c:432</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a6776217a5f7ba38b56175cf6db0f96e0"><div class="ttname"><a href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a></div><div class="ttdeci">void validateMultiTargets(Qureg qureg, int *targetQubits, int numTargetQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00392">QuEST_validation.c:392</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_ae776148507b8f769cd00d1603212a028"><div class="ttname"><a href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a></div><div class="ttdeci">void qasm_recordControlledParamGate(Qureg qureg, TargetGate gate, int controlQubit, int targetQubit, qreal param)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00247">QuEST_qasm.c:247</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_adf5fbea75826cde7d86fd7c31bcf3dec"><div class="ttname"><a href="QuEST__common_8c.html#adf5fbea75826cde7d86fd7c31bcf3dec">statevec_rotateAroundAxis</a></div><div class="ttdeci">void statevec_rotateAroundAxis(Qureg qureg, int rotQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00311">QuEST_common.c:311</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a9fd917537204e074119d4f283dea78e3"><div class="ttname"><a href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a></div><div class="ttdeci">void setConjugateMatrixN(ComplexMatrixN m)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00109">QuEST_common.c:109</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a3eadcb581f2623e21e4967f791d0439c"><div class="ttname"><a href="QuEST__internal_8h.html#a3eadcb581f2623e21e4967f791d0439c">statevec_multiControlledTwoQubitUnitary</a></div><div class="ttdeci">void statevec_multiControlledTwoQubitUnitary(Qureg qureg, long long int ctrlMask, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdoc">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01381">QuEST_cpu_distributed.c:1381</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a33be8162c9633bb8015f06b38cf70735"><div class="ttname"><a href="QuEST__qasm_8c.html#a33be8162c9633bb8015f06b38cf70735">qasm_recordControlledAxisRotation</a></div><div class="ttdeci">void qasm_recordControlledAxisRotation(Qureg qureg, qreal angle, Vector axis, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00300">QuEST_qasm.c:300</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_acc45bb8300922ea5933e294921e25ea2"><div class="ttname"><a href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a></div><div class="ttdeci">long long int getQubitBitMask(int *qubits, int numQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00044">QuEST_common.c:44</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aec63559e8b9ab0e17efe18d64d2ceca6"><div class="ttname"><a href="QuEST__internal_8h.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a></div><div class="ttdeci">void statevec_compactUnitary(Qureg qureg, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00844">QuEST_cpu_distributed.c:844</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2153d8611247dd3a2ef483355265cc99"><div class="ttname"><a href="QuEST__common_8c.html#a2153d8611247dd3a2ef483355265cc99">statevec_multiRotatePauli</a></div><div class="ttdeci">void statevec_multiRotatePauli(Qureg qureg, int *targetQubits, enum pauliOpType *targetPaulis, int numTargets, qreal angle, int applyConj)</div><div class="ttdoc">applyConj=1 will apply conjugate operation, else applyConj=0</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00411">QuEST_common.c:411</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ac4ee5979d475e8c729294b8ef7e0270d"><div class="ttname"><a href="QuEST__internal_8h.html#ac4ee5979d475e8c729294b8ef7e0270d">statevec_multiControlledPhaseFlip</a></div><div class="ttdeci">void statevec_multiControlledPhaseFlip(Qureg qureg, int *controlQubits, int numControlQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03331">QuEST_cpu.c:3331</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a9a385fde708958617bbeb599064b8dcb"><div class="ttname"><a href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a></div><div class="ttdeci">void qasm_recordComment(Qureg qureg, char *comment,...)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00120">QuEST_qasm.c:120</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a7a76950824f17e821415070a4bfdad5b"><div class="ttname"><a href="QuEST__common_8c.html#a7a76950824f17e821415070a4bfdad5b">statevec_multiQubitUnitary</a></div><div class="ttdeci">void statevec_multiQubitUnitary(Qureg qureg, int *targets, int numTargets, ComplexMatrixN u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00529">QuEST_common.c:529</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a336c3286d2434fc892ebe20e9fa22a24"><div class="ttname"><a href="QuEST__common_8c.html#a336c3286d2434fc892ebe20e9fa22a24">statevec_controlledRotateAroundAxis</a></div><div class="ttdeci">void statevec_controlledRotateAroundAxis(Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00327">QuEST_common.c:327</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a142b424d903dfaca7a7ac166076f543a"><div class="ttname"><a href="QuEST__common_8c.html#a142b424d903dfaca7a7ac166076f543a">statevec_sGateConj</a></div><div class="ttdeci">void statevec_sGateConj(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00279">QuEST_common.c:279</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2cbfe9f416d4d8acb56213841f62cb53"><div class="ttname"><a href="QuEST__common_8c.html#a2cbfe9f416d4d8acb56213841f62cb53">statevec_rotateAroundAxisConj</a></div><div class="ttdeci">void statevec_rotateAroundAxisConj(Qureg qureg, int rotQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00318">QuEST_common.c:318</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a6fa6f1bc617e9fef3cd87ecc3677a02b"><div class="ttname"><a href="QuEST__common_8c.html#a6fa6f1bc617e9fef3cd87ecc3677a02b">getControlFlipMask</a></div><div class="ttdeci">long long int getControlFlipMask(int *controlQubits, int *controlState, int numControlQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00054">QuEST_common.c:54</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a3a79e4305d35f1756b8438bbd34ea6cc"><div class="ttname"><a href="QuEST__qasm_8c.html#a3a79e4305d35f1756b8438bbd34ea6cc">qasm_recordMultiControlledUnitary</a></div><div class="ttdeci">void qasm_recordMultiControlledUnitary(Qureg qureg, ComplexMatrix2 u, int *controlQubits, int numControlQubits, int targetQubit)</div><div class="ttdoc">additionally performs Rz on target to restore the global phase lost from u in QASM U(a,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00341">QuEST_qasm.c:341</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a1445a08d034806627cc0b5aa0f4f6d3a"><div class="ttname"><a href="QuEST__qasm_8c.html#a1445a08d034806627cc0b5aa0f4f6d3a">qasm_recordMultiControlledParamGate</a></div><div class="ttdeci">void qasm_recordMultiControlledParamGate(Qureg qureg, TargetGate gate, int *controlQubits, int numControlQubits, int targetQubit, qreal param)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00324">QuEST_qasm.c:324</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_abb2eab4af99adcc59be24f4c91c6f6ad"><div class="ttname"><a href="QuEST__internal_8h.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a></div><div class="ttdeci">void statevec_controlledNot(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01061">QuEST_cpu_distributed.c:1061</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a654db9d60abdcae26427e7d3b3d9c432"><div class="ttname"><a href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a></div><div class="ttdeci">void validateTwoQubitUnitaryMatrix(Qureg qureg, ComplexMatrix4 u, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00445">QuEST_validation.c:445</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_aa32eed5bc38e85193e1aa23b74e8541b"><div class="ttname"><a href="QuEST__common_8c.html#aa32eed5bc38e85193e1aa23b74e8541b">statevec_controlledRotateX</a></div><div class="ttdeci">void statevec_controlledRotateX(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00343">QuEST_common.c:343</a></div></div>
<div class="ttc" id="astructQureg_html_acf78445e9435d09f44f0cc832c6aee79"><div class="ttname"><a href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">Qureg::isDensityMatrix</a></div><div class="ttdeci">int isDensityMatrix</div><div class="ttdoc">Whether this instance is a density-state representation.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00206">QuEST.h:206</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_af3fc7bd149c70f083b149050242cd55e"><div class="ttname"><a href="QuEST__internal_8h.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a></div><div class="ttdeci">void statevec_hadamard(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01206">QuEST_cpu_distributed.c:1206</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a1f0db2800d13b6c2b120e05129cd13cb"><div class="ttname"><a href="QuEST__common_8c.html#a1f0db2800d13b6c2b120e05129cd13cb">statevec_rotateY</a></div><div class="ttdeci">void statevec_rotateY(Qureg qureg, int rotQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00299">QuEST_common.c:299</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a600bda10463e2078ce746ec28f2d39c9"><div class="ttname"><a href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a></div><div class="ttdeci">void statevec_multiControlledUnitary(Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00997">QuEST_cpu_distributed.c:997</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a0344fbbb2bb505f7db14b420153f1eb5"><div class="ttname"><a href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a></div><div class="ttdeci">void validateOneQubitUnitaryMatrix(ComplexMatrix2 u, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00441">QuEST_validation.c:441</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a33cde9b6518d55a544eff20301a5d844"><div class="ttname"><a href="QuEST__common_8c.html#a33cde9b6518d55a544eff20301a5d844">statevec_sqrtSwapGateConj</a></div><div class="ttdeci">void statevec_sqrtSwapGateConj(Qureg qureg, int qb1, int qb2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00397">QuEST_common.c:397</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a3e11a9b9fa5ee16d4738a97f4590ee61"><div class="ttname"><a href="QuEST__common_8c.html#a3e11a9b9fa5ee16d4738a97f4590ee61">statevec_controlledRotateZ</a></div><div class="ttdeci">void statevec_controlledRotateZ(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00355">QuEST_common.c:355</a></div></div>
<div class="ttc" id="astructQureg_html_ad08dff5316b8937f4b2a1417591543dc"><div class="ttname"><a href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">Qureg::numQubitsRepresented</a></div><div class="ttdeci">int numQubitsRepresented</div><div class="ttdoc">The number of qubits represented in either the state-vector or density matrix.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00208">QuEST.h:208</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a1c82b5e914a8a39c5c7b782dbc16fa76"><div class="ttname"><a href="QuEST__internal_8h.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a></div><div class="ttdeci">void statevec_pauliX(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01034">QuEST_cpu_distributed.c:1034</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5b0392701c555a898403f80ef4a32f62"><div class="ttname"><a href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a></div><div class="ttdeci">void validateMultiControlsMultiTargets(Qureg qureg, int *controlQubits, int numControlQubits, int *targetQubits, int numTargetQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00423">QuEST_validation.c:423</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa5053f3d968443bc04e8b1d09f18bab9a"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa5053f3d968443bc04e8b1d09f18bab9a">GATE_S</a></div><div class="ttdeci">@ GATE_S</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00025">QuEST_qasm.h:25</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fab12d052de2b7c59c6ab87710fd7d3c78"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab12d052de2b7c59c6ab87710fd7d3c78">GATE_SWAP</a></div><div class="ttdeci">@ GATE_SWAP</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00033">QuEST_qasm.h:33</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aaf78491e35d165edfd57387f9fffecbd"><div class="ttname"><a href="QuEST__internal_8h.html#aaf78491e35d165edfd57387f9fffecbd">statevec_controlledPhaseFlip</a></div><div class="ttdeci">void statevec_controlledPhaseFlip(Qureg qureg, int idQubit1, int idQubit2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03300">QuEST_cpu.c:3300</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b">GATE_SIGMA_Y</a></div><div class="ttdeci">@ GATE_SIGMA_Y</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00022">QuEST_qasm.h:22</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a518c4351d574aea8477019dbce02f09c"><div class="ttname"><a href="QuEST__qasm_8c.html#a518c4351d574aea8477019dbce02f09c">qasm_recordCompactUnitary</a></div><div class="ttdeci">void qasm_recordCompactUnitary(Qureg qureg, Complex alpha, Complex beta, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00195">QuEST_qasm.c:195</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a5e99d405002cdf6ddd40922911d058a4"><div class="ttname"><a href="QuEST__qasm_8c.html#a5e99d405002cdf6ddd40922911d058a4">qasm_recordControlledUnitary</a></div><div class="ttdeci">void qasm_recordControlledUnitary(Qureg qureg, ComplexMatrix2 u, int controlQubit, int targetQubit)</div><div class="ttdoc">additionally performs Rz on target to restore the global phase lost from u in QASM U(a,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00278">QuEST_qasm.c:278</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ade67874c89179541f616b3685595d3ae"><div class="ttname"><a href="QuEST__common_8c.html#ade67874c89179541f616b3685595d3ae">statevec_controlledRotateY</a></div><div class="ttdeci">void statevec_controlledRotateY(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00349">QuEST_common.c:349</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a5ea2384a9b33c94eac891aacbfa5da6a"><div class="ttname"><a href="QuEST__common_8c.html#a5ea2384a9b33c94eac891aacbfa5da6a">statevec_controlledRotateAroundAxisConj</a></div><div class="ttdeci">void statevec_controlledRotateAroundAxisConj(Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00334">QuEST_common.c:334</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a81749d23b8c3c1acf87c9db675872c24"><div class="ttname"><a href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a></div><div class="ttdeci">void qasm_recordGate(Qureg qureg, TargetGate gate, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00178">QuEST_qasm.c:178</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aa194ba5f5c6e19c6caa4c715b3dbefcc"><div class="ttname"><a href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a></div><div class="ttdeci">void validatePauliCodes(enum pauliOpType *pauliCodes, int numPauliCodes, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00563">QuEST_validation.c:563</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5d49d4aadea858794b139c6a195ffd8b"><div class="ttname"><a href="QuEST__validation_8c.html#a5d49d4aadea858794b139c6a195ffd8b">validateUnitaryComplexPair</a></div><div class="ttdeci">void validateUnitaryComplexPair(Complex alpha, Complex beta, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00471">QuEST_validation.c:471</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689">GATE_ROTATE_Y</a></div><div class="ttdeci">@ GATE_ROTATE_Y</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00028">QuEST_qasm.h:28</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2b2b8c69566a49cdf4a3fa2cb4f5e03c"><div class="ttname"><a href="QuEST__common_8c.html#a2b2b8c69566a49cdf4a3fa2cb4f5e03c">statevec_rotateZ</a></div><div class="ttdeci">void statevec_rotateZ(Qureg qureg, int rotQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00305">QuEST_common.c:305</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a1275d604674224d87a173fb5bac78835"><div class="ttname"><a href="QuEST__internal_8h.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a></div><div class="ttdeci">void statevec_controlledCompactUnitary(Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00920">QuEST_cpu_distributed.c:920</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aed5f85789dc4fa43b64e99e6b538035c"><div class="ttname"><a href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a></div><div class="ttdeci">void validateUniqueTargets(Qureg qureg, int qubit1, int qubit2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00378">QuEST_validation.c:378</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a81fbd2eccd0d0e5a3cece4df2f96cb92"><div class="ttname"><a href="QuEST__internal_8h.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">statevec_pauliYConj</a></div><div class="ttdeci">void statevec_pauliYConj(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01115">QuEST_cpu_distributed.c:1115</a></div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
</body>
        <script type="text/javascript" src="boot.js"></script>
</html>
